| 1 | <?php |
||
| 18 | class PullCollectionTest extends UnitTestCase |
||
| 19 | { |
||
| 20 | public function testPullRemovesItemFromCollectionAndReturnsIt() |
||
| 21 | { |
||
| 22 | $coll = Factory::create($this->fixtures['assoc']); |
||
| 23 | $this->assertCount(3, $coll); |
||
| 24 | $this->assertTrue($coll->containsKey('2nd')); |
||
| 25 | $this->assertSame( |
||
| 26 | 'second', |
||
| 27 | $pulled = $coll->pull('2nd'), |
||
| 28 | 'Collection::pull() should return an item by key and return it.' |
||
| 29 | ); |
||
| 30 | $this->assertFalse($coll->containsKey('2nd')); |
||
| 31 | $this->assertCount(2, $coll); |
||
| 32 | $this->assertNull($coll->pull('2nd'), 'Collection::pull() should return null if key does not exist.'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |