summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Statements/InsertStatement.php2
-rw-r--r--src/Statements/LoadStatement.php4
-rw-r--r--src/Utils/CLI.php2
-rw-r--r--tests/Builder/CreateStatementTest.php12
-rw-r--r--tests/Builder/StatementTest.php2
-rw-r--r--tests/Components/FunctionCallTest.php2
-rw-r--r--tests/Components/OptionsArrayTest.php6
-rw-r--r--tests/Lexer/ContextTest.php2
-rw-r--r--tests/Utils/CLITest.php22
-rw-r--r--tests/Utils/ErrorTest.php4
-rw-r--r--tests/Utils/FormatterTest.php4
-rw-r--r--tools/TestGenerator.php2
12 files changed, 34 insertions, 30 deletions
diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php
index c65931e..4e48c0d 100644
--- a/src/Statements/InsertStatement.php
+++ b/src/Statements/InsertStatement.php
@@ -195,7 +195,7 @@ class InsertStatement extends Statement
$this->into = IntoKeyword::parse(
$parser,
$list,
- ['fromInsert' => true]
+ array('fromInsert' => true)
);
$state = 1;
diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php
index 6eb182a..422efc7 100644
--- a/src/Statements/LoadStatement.php
+++ b/src/Statements/LoadStatement.php
@@ -281,7 +281,7 @@ class LoadStatement extends Statement
$this->file_name = Expression::parse(
$parser,
$list,
- ['parseField' => 'file']
+ array('parseField' => 'file')
);
$state = 1;
} elseif ($state === 1) {
@@ -298,7 +298,7 @@ class LoadStatement extends Statement
&& $token->keyword === 'TABLE'
) {
++$list->idx;
- $this->table = Expression::parse($parser, $list, ['parseField' => 'table']);
+ $this->table = Expression::parse($parser, $list, array('parseField' => 'table'));
$state = 3;
} else {
$parser->error('Unexpected token.', $token);
diff --git a/src/Utils/CLI.php b/src/Utils/CLI.php
index 2acc81c..60af222 100644
--- a/src/Utils/CLI.php
+++ b/src/Utils/CLI.php
@@ -142,7 +142,7 @@ class CLI
if (isset($params['q'])) {
$lexer = new Lexer($params['q'], false);
$parser = new Parser($lexer->list);
- $errors = Error::get([$lexer, $parser]);
+ $errors = Error::get(array($lexer, $parser));
if (count($errors) === 0) {
return 0;
}
diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php
index 52f4f00..19989cb 100644
--- a/tests/Builder/CreateStatementTest.php
+++ b/tests/Builder/CreateStatementTest.php
@@ -99,17 +99,17 @@ class CreateStatementTest extends TestCase
$stmt = new CreateStatement();
$stmt->name = new Expression('', 'test', '');
- $stmt->options = new OptionsArray(['TABLE']);
+ $stmt->options = new OptionsArray(array('TABLE'));
$stmt->fields = array(
new CreateDefinition(
'id',
- new OptionsArray(['NOT NULL', 'AUTO_INCREMENT']),
- new DataType('INT', array(11), new OptionsArray(['UNSIGNED']))
+ new OptionsArray(array('NOT NULL', 'AUTO_INCREMENT')),
+ new DataType('INT', array(11), new OptionsArray(array('UNSIGNED')))
),
new CreateDefinition(
'',
null,
- new Key('', array(['name' => 'id']), 'PRIMARY KEY')
+ new Key('', array(array('name' => 'id')), 'PRIMARY KEY')
)
);
@@ -289,9 +289,9 @@ EOT
{
$stmt = new CreateStatement();
- $stmt->options = new OptionsArray(['TRIGGER']);
+ $stmt->options = new OptionsArray(array('TRIGGER'));
$stmt->name = new Expression('ins_sum');
- $stmt->entityOptions = new OptionsArray(['BEFORE', 'INSERT']);
+ $stmt->entityOptions = new OptionsArray(array('BEFORE', 'INSERT'));
$stmt->table = new Expression('account');
$stmt->body = 'SET @sum = @sum + NEW.amount';
diff --git a/tests/Builder/StatementTest.php b/tests/Builder/StatementTest.php
index f97044d..178901a 100644
--- a/tests/Builder/StatementTest.php
+++ b/tests/Builder/StatementTest.php
@@ -15,7 +15,7 @@ class StatementTest extends TestCase
{
$stmt = new SelectStatement();
- $stmt->options = new OptionsArray(['DISTINCT']);
+ $stmt->options = new OptionsArray(array('DISTINCT'));
$stmt->expr[] = new Expression('sakila', 'film', 'film_id', 'fid');
$stmt->expr[] = new Expression('COUNT(film_id)');
diff --git a/tests/Components/FunctionCallTest.php b/tests/Components/FunctionCallTest.php
index c4c0c26..b8b485a 100644
--- a/tests/Components/FunctionCallTest.php
+++ b/tests/Components/FunctionCallTest.php
@@ -16,7 +16,7 @@ class FunctionCallTest extends TestCase
public function testBuildArrayObj()
{
- $component = new FunctionCall('func', new ArrayObj(['a', 'b']));
+ $component = new FunctionCall('func', new ArrayObj(array('a', 'b')));
$this->assertEquals('func(a, b)', FunctionCall::build($component));
}
}
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php
index bebf62f..a642f83 100644
--- a/tests/Components/OptionsArrayTest.php
+++ b/tests/Components/OptionsArrayTest.php
@@ -81,7 +81,7 @@ class OptionsArrayTest extends TestCase
public function testRemove()
{
/* Assertion 1 */
- $component = new OptionsArray(['a', 'b', 'c']);
+ $component = new OptionsArray(array('a', 'b', 'c'));
$this->assertTrue($component->remove('b'));
$this->assertFalse($component->remove('d'));
$this->assertEquals($component->options, array(0 => 'a', 2 => 'c'));
@@ -106,8 +106,8 @@ class OptionsArrayTest extends TestCase
public function testMerge()
{
- $component = new OptionsArray(['a']);
- $component->merge(['b', 'c']);
+ $component = new OptionsArray(array('a'));
+ $component->merge(array('b', 'c'));
$this->assertEquals($component->options, array('a', 'b', 'c'));
}
diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php
index 6116db2..980eecd 100644
--- a/tests/Lexer/ContextTest.php
+++ b/tests/Lexer/ContextTest.php
@@ -143,7 +143,7 @@ class ContextTest extends TestCase
'`a`',
'`b`',
),
- Context::escape(['a', 'b'])
+ Context::escape(array('a', 'b'))
);
}
}
diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php
index 4a81f61..366c480 100644
--- a/tests/Utils/CLITest.php
+++ b/tests/Utils/CLITest.php
@@ -8,7 +8,7 @@ class CLITest extends TestCase
{
private function getCLI($getopt)
{
- $cli = $this->getMockBuilder('PhpMyAdmin\SqlParser\Utils\CLI')->setMethods(['getopt'])->getMock();
+ $cli = $this->getMockBuilder('PhpMyAdmin\SqlParser\Utils\CLI')->setMethods(array('getopt'))->getMock();
$cli->method('getopt')->willReturn($getopt);
return $cli;
@@ -48,12 +48,12 @@ class CLITest extends TestCase
array(
array('q' => 'SELECT 1'),
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
- 0,
+ 0
),
array(
array('query' => 'SELECT 1'),
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
- 0,
+ 0
),
array(
array(
@@ -61,7 +61,7 @@ class CLITest extends TestCase
'f' => 'text',
),
"SELECT\n /* comment */ 1 /* other */\n",
- 0,
+ 0
),
array(
array(
@@ -69,7 +69,7 @@ class CLITest extends TestCase
'f' => 'foo',
),
"ERROR: Invalid value for format!\n",
- 1,
+ 1
),
array(
array(
@@ -78,13 +78,13 @@ class CLITest extends TestCase
),
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>' . "\n",
- 0,
+ 0
),
array(
array('h' => true),
'Usage: highlight-query --query SQL [--format html|cli|text]' . "\n" .
' cat file.sql | highlight-query' . "\n",
- 0,
+ 0
),
array(
array(),
@@ -96,7 +96,7 @@ class CLITest extends TestCase
array(
false,
'',
- 1,
+ 1
)
);
}
@@ -225,7 +225,11 @@ class CLITest extends TestCase
public function stdinParams()
{
- $binPath = PHP_BINARY .' '. dirname(__DIR__,2 ). '/bin/';
+ if (defined('PHP_BINARY')) {
+ $binPath = PHP_BINARY . ' ' . dirname(__DIR__, 2) . '/bin/';
+ } else {
+ $binPath = 'php' . ' ' . realpath(dirname(__DIR__) . '/../') . '/bin/';
+ }
return array(
array('echo "SELECT 1" | '. $binPath .'highlight-query', 0),
diff --git a/tests/Utils/ErrorTest.php b/tests/Utils/ErrorTest.php
index fb441f8..2d3da43 100644
--- a/tests/Utils/ErrorTest.php
+++ b/tests/Utils/ErrorTest.php
@@ -28,7 +28,7 @@ class ErrorTest extends TestCase
17,
),
),
- Error::get([$lexer, $parser])
+ Error::get(array($lexer, $parser))
);
}
@@ -36,7 +36,7 @@ class ErrorTest extends TestCase
{
$this->assertEquals(
array('#1: error msg (near "token" at position 100)'),
- Error::format([['error msg', 42, 'token', 100]])
+ Error::format(array(array('error msg', 42, 'token', 100)))
);
}
}
diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php
index aa84564..3551dc6 100644
--- a/tests/Utils/FormatterTest.php
+++ b/tests/Utils/FormatterTest.php
@@ -18,7 +18,7 @@ class FormatterTest extends TestCase
{
$formatter = $this->getMockBuilder('PhpMyAdmin\SqlParser\Utils\Formatter')
->disableOriginalConstructor()
- ->setMethods(['getDefaultOptions', 'getDefaultFormats'])
+ ->setMethods(array('getDefaultOptions', 'getDefaultFormats'))
->getMock();
$formatter->expects($this->once())
@@ -57,7 +57,7 @@ class FormatterTest extends TestCase
public function mergeFormats()
{
- // array($default[), $overriding[), $expected[])
+ // array($default[], $overriding[], $expected[])
return array(
'empty formats' => array(
'default' => array(
diff --git a/tools/TestGenerator.php b/tools/TestGenerator.php
index 6867fed..5f59f01 100644
--- a/tools/TestGenerator.php
+++ b/tools/TestGenerator.php
@@ -109,7 +109,7 @@ class TestGenerator
public static function build($type, $input, $output, $debug = null)
{
// Support query types: `lexer` / `parser`.
- if (! in_array($type, ['lexer', 'parser'])) {
+ if (! in_array($type, array('lexer', 'parser'))) {
throw new \Exception('Unknown test type (expected `lexer` or `parser`).');
}