diff options
Diffstat (limited to 'tests/Components/OptionsArrayTest.php')
-rw-r--r-- | tests/Components/OptionsArrayTest.php | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php index a642f83..3904fdf 100644 --- a/tests/Components/OptionsArrayTest.php +++ b/tests/Components/OptionsArrayTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tests\Components; @@ -13,26 +14,26 @@ class OptionsArrayTest extends TestCase $component = OptionsArray::parse( new Parser(), $this->getTokensList('A B = /*comment*/ (test) C'), - array( + [ 'A' => 1, - 'B' => array( + 'B' => [ 2, 'var', - ), - 'C' => 3 - ) + ], + 'C' => 3, + ] ); $this->assertEquals( - array( + [ 1 => 'A', - 2 => array( + 2 => [ 'name' => 'B', 'expr' => '(test)', 'value' => 'test', 'equals' => true, - ), + ], 3 => 'C', - ), + ], $component->options ); } @@ -42,17 +43,17 @@ class OptionsArrayTest extends TestCase $component = OptionsArray::parse( new Parser(), $this->getTokensList('SUM = (3 + 5) RESULT = 8'), - array( - 'SUM' => array( + [ + 'SUM' => [ 1, 'expr', - array('parenthesesDelimited' => true), - ), - 'RESULT' => array( + ['parenthesesDelimited' => true], + ], + 'RESULT' => [ 2, 'var', - ) - ) + ], + ] ); $this->assertEquals('(3 + 5)', (string) $component->has('SUM', true)); $this->assertEquals('8', $component->has('RESULT')); @@ -63,14 +64,14 @@ class OptionsArrayTest extends TestCase $component = OptionsArray::parse( new Parser(), $this->getTokensList('A B = /*comment*/ (test) C'), - array( + [ 'A' => 1, - 'B' => array( + 'B' => [ 2, 'var', - ), - 'C' => 3 - ) + ], + 'C' => 3, + ] ); $this->assertTrue($component->has('A')); $this->assertEquals('test', $component->has('B')); @@ -81,23 +82,23 @@ class OptionsArrayTest extends TestCase public function testRemove() { /* Assertion 1 */ - $component = new OptionsArray(array('a', 'b', 'c')); + $component = new OptionsArray(['a', 'b', 'c']); $this->assertTrue($component->remove('b')); $this->assertFalse($component->remove('d')); - $this->assertEquals($component->options, array(0 => 'a', 2 => 'c')); + $this->assertEquals($component->options, [0 => 'a', 2 => 'c']); /* Assertion 2 */ $component = OptionsArray::parse( new Parser(), $this->getTokensList('A B = /*comment*/ (test) C'), - array( + [ 'A' => 1, - 'B' => array( + 'B' => [ 2, 'var', - ), - 'C' => 3 - ) + ], + 'C' => 3, + ] ); $this->assertEquals('test', $component->has('B')); $component->remove('B'); @@ -106,23 +107,23 @@ class OptionsArrayTest extends TestCase public function testMerge() { - $component = new OptionsArray(array('a')); - $component->merge(array('b', 'c')); - $this->assertEquals($component->options, array('a', 'b', 'c')); + $component = new OptionsArray(['a']); + $component->merge(['b', 'c']); + $this->assertEquals($component->options, ['a', 'b', 'c']); } public function testBuild() { $component = new OptionsArray( - array( + [ 'ALL', 'SQL_CALC_FOUND_ROWS', - array( + [ 'name' => 'MAX_STATEMENT_TIME', 'value' => '42', 'equals' => true, - ), - ) + ], + ] ); $this->assertEquals( OptionsArray::build($component), |