Skip to content

Commit c70914a

Browse files
committed
Add tests for removal of option which has value attached to it
Signed-off-by: Deven Bansod <[email protected]>
1 parent 9c4d5f0 commit c70914a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Components/OptionsArrayTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,25 @@ public function testHas()
6969

7070
public function testRemove()
7171
{
72+
/* Assertion 1 */
7273
$component = new OptionsArray(array('a', 'b', 'c'));
7374
$this->assertTrue($component->remove('b'));
7475
$this->assertFalse($component->remove('d'));
7576
$this->assertEquals($component->options, array(0 => 'a', 2 => 'c'));
77+
78+
/* Assertion 2 */
79+
$component = OptionsArray::parse(
80+
new Parser(),
81+
$this->getTokensList('A B = /*comment*/ (test) C'),
82+
array(
83+
'A' => 1,
84+
'B' => array(2, 'var'),
85+
'C' => 3,
86+
)
87+
);
88+
$this->assertEquals('test', $component->has('B'));
89+
$component->remove('B');
90+
$this->assertFalse($component->has('B'));
7691
}
7792

7893
public function testMerge()

0 commit comments

Comments
 (0)