summaryrefslogtreecommitdiffstats
path: root/tests/Utils/FormatterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Utils/FormatterTest.php')
-rw-r--r--tests/Utils/FormatterTest.php40
1 files changed, 31 insertions, 9 deletions
diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php
index af1966f..4cf7879 100644
--- a/tests/Utils/FormatterTest.php
+++ b/tests/Utils/FormatterTest.php
@@ -265,17 +265,39 @@ class FormatTest extends TestCase
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;*',
),
- 'select with comment' => array(
- 'query' => 'select 1 # Comment',
+ 'select with comments' => array(
+ 'query' =>
+ 'select * /* Comment */' . "\n" .
+ 'from tbl # Comment' . "\n" .
+ 'where 1 -- Comment',
'text' =>
- "SELECT\n" .
- " 1 # Comment" . "\n",
+ "SELECT" . "\n" .
+ " *" . "\n" .
+ " /* Comment */" . "\n" .
+ "FROM" . "\n" .
+ " tbl" . "\n".
+ " # Comment" . "\n" .
+ "WHERE" . "\n" .
+ " 1 -- Comment" . "\n",
'cli' =>
"\x1b[35mSELECT" . "\n" .
- " \x1b[92m1 \x1b[37m# Comment\\x0A" . "\x1b[0m",
+ " \x1b[39m*" . "\n" .
+ " \x1b[37m/* Comment */" . "\n" .
+ "\x1b[35mFROM" . "\n" .
+ " \x1b[39mtbl" . "\n" .
+ " \x1b[37m# Comment\\x0A" .
+ "\x1b[35mWHERE" . "\n" .
+ " \x1b[92m1 \x1b[37m-- Comment\\x0A" . "\x1b[0m",
'html' =>
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
- '&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span> <span class="sql-comment"># Comment' . "\n" .
+ '&nbsp;&nbsp;&nbsp;&nbsp;*' . '<br/>' .
+ ' <span class="sql-comment">/* Comment */</span>' . "\n" .
+ '<span class="sql-reserved">FROM</span>' . '<br/>' .
+ '&nbsp;&nbsp;&nbsp;&nbsp;tbl' . '<br/>' .
+ ' <span class="sql-comment"># Comment' . "\n" .
+ '</span>' .
+ '<span class="sql-reserved">WHERE</span>' . '<br/>' .
+ '&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span> <span class="sql-comment">-- Comment' . "\n" .
'</span>',
),
);
@@ -295,7 +317,7 @@ class FormatTest extends TestCase
public function formatQueries()
{
return array(
- array(
+ array( # DONE
'SELECT 1',
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>',
@@ -313,13 +335,13 @@ class FormatTest extends TestCase
' 1 -- Comment',
array('type' => 'text'),
),
- array(
+ array( # DONE
'SELECT 1 # Comment',
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span> <span class="sql-comment"># Comment</span>',
array('type' => 'html'),
),
- array(
+ array( # DONE
'SELECT 1 -- comment',
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span> <span class="sql-comment">-- comment</span>',