summaryrefslogtreecommitdiffstats
path: root/tests/Components/OptionsArrayTest.php
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2019-01-08 21:32:02 -0200
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2019-01-16 17:21:25 -0200
commit86c5baebda24c1721fb6881df8671a3c7df60e8b (patch)
tree0a76d58ea229d1008e169b1c5b25ce90dde91808 /tests/Components/OptionsArrayTest.php
parent28427543566b6dd32fe44db704ea41368ba55c0e (diff)
downloadsql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.zip
sql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.tar.gz
sql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.tar.bz2
Apply phpmyadmin/coding-standard
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'tests/Components/OptionsArrayTest.php')
-rw-r--r--tests/Components/OptionsArrayTest.php68
1 files changed, 42 insertions, 26 deletions
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php
index 4dda0db..c5b6eb7 100644
--- a/tests/Components/OptionsArrayTest.php
+++ b/tests/Components/OptionsArrayTest.php
@@ -13,23 +13,26 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('A B = /*comment*/ (test) C'),
- array(
+ [
'A' => 1,
- 'B' => array(2, 'var'),
+ 'B' => [
+ 2,
+ 'var',
+ ],
'C' => 3,
- )
+ ]
);
$this->assertEquals(
- array(
+ [
1 => 'A',
- 2 => array(
+ 2 => [
'name' => 'B',
'expr' => '(test)',
'value' => 'test',
'equals' => true,
- ),
+ ],
3 => 'C',
- ),
+ ],
$component->options
);
}
@@ -39,10 +42,17 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('SUM = (3 + 5) RESULT = 8'),
- array(
- 'SUM' => array(1, 'expr', array('parenthesesDelimited' => true)),
- 'RESULT' => array(2, 'var'),
- )
+ [
+ 'SUM' => [
+ 1,
+ 'expr',
+ ['parenthesesDelimited' => true],
+ ],
+ 'RESULT' => [
+ 2,
+ 'var',
+ ],
+ ]
);
$this->assertEquals('(3 + 5)', (string) $component->has('SUM', true));
$this->assertEquals('8', $component->has('RESULT'));
@@ -53,11 +63,14 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('A B = /*comment*/ (test) C'),
- array(
+ [
'A' => 1,
- 'B' => array(2, 'var'),
+ 'B' => [
+ 2,
+ 'var',
+ ],
'C' => 3,
- )
+ ]
);
$this->assertTrue($component->has('A'));
$this->assertEquals('test', $component->has('B'));
@@ -68,20 +81,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(2, 'var'),
+ 'B' => [
+ 2,
+ 'var',
+ ],
'C' => 3,
- )
+ ]
);
$this->assertEquals('test', $component->has('B'));
$component->remove('B');
@@ -90,23 +106,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),