1 | <?php |
||
18 | class RemoveCollectionTest extends UnitTestCase |
||
19 | { |
||
20 | public function testRemoveRemovesItemByKey() |
||
21 | { |
||
22 | $exp = $this->fixtures['assoc']; |
||
23 | $coll = Factory::create($exp); |
||
24 | $this->assertTrue($coll->containsKey('2nd')); |
||
25 | $removed = $coll->remove('2nd'); |
||
26 | $this->assertFalse($coll->containsKey('2nd')); |
||
27 | $this->assertSame($coll, $removed, 'Remove method should return the collection itself.'); |
||
28 | $return = $coll->remove('2nd'); |
||
29 | $this->assertSame( |
||
30 | $coll, |
||
31 | $return, |
||
32 | 'Attempting to remove an item that does not exist should still return the collection itself.' |
||
33 | ); |
||
34 | } |
||
35 | } |
||
36 |