| 1 | <?php |
||
| 18 | class GetCollectionTest extends UnitTestCase |
||
| 19 | { |
||
| 20 | public function testGetReturnsItemIfItExists() |
||
| 21 | { |
||
| 22 | $exp = $this->fixtures['assoc']; |
||
| 23 | $coll = Factory::create($exp); |
||
| 24 | $this->assertEquals('second', $coll->get('2nd')); |
||
| 25 | $coll->remove('2nd'); |
||
| 26 | $this->assertNull($coll->get('2nd')); |
||
| 27 | $this->assertEquals( |
||
| 28 | 'default', |
||
| 29 | $coll->get('2nd', 'default'), |
||
| 30 | 'If a default is provided, Collection::get() should return it if no item is found.' |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |