summaryrefslogtreecommitdiffstats
path: root/tests/Components/OptionsArrayTest.php
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-07-10 21:40:24 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-07-10 21:40:24 +0300
commit30fdd07d36a48031afe04df2ce54307e3b4bc7b2 (patch)
tree1c36f8e4109b21404945877a61c4a6c7a54aa2a1 /tests/Components/OptionsArrayTest.php
parent80cc0cd6920e4266b97e915289e6d0c146086968 (diff)
downloadsql-parser-30fdd07d36a48031afe04df2ce54307e3b4bc7b2.zip
sql-parser-30fdd07d36a48031afe04df2ce54307e3b4bc7b2.tar.gz
sql-parser-30fdd07d36a48031afe04df2ce54307e3b4bc7b2.tar.bz2
Added remove() method for OptionsArray.
Fixed undefined variables introduced by previous renaming. Some refactoring.
Diffstat (limited to 'tests/Components/OptionsArrayTest.php')
-rw-r--r--tests/Components/OptionsArrayTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php
index 0c453da..42f54dd 100644
--- a/tests/Components/OptionsArrayTest.php
+++ b/tests/Components/OptionsArrayTest.php
@@ -36,6 +36,34 @@ class OptionsArrayTest extends TestCase
);
}
+ public function testHas()
+ {
+ $component = new OptionsArray(
+ array(
+ 1 => 'A',
+ 2 => array(
+ 'name' => 'B',
+ 'value' => 'test',
+ 'value_' => 'test',
+ 'equal' => false,
+ ),
+ 3 => 'C'
+ )
+ );
+ $this->assertTrue($component->has('A'));
+ $this->assertEquals('test', $component->has('B'));
+ $this->assertTrue($component->has('C'));
+ $this->assertFalse($component->has('D'));
+ }
+
+ public function testRemove()
+ {
+ $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'));
+ }
+
public function testMerge()
{
$component = new OptionsArray(array('a'));