ArrTest.php 493 B

1234567891011121314151617
  1. <?php
  2. class ArrTest extends PHPUnit_Framework_TestCase {
  3. public function testReturnsDefaultWhenItemNotPresentInArray()
  4. {
  5. $this->assertNull(System\Arr::get(array(), 'name'));
  6. $this->assertEquals(System\Arr::get(array(), 'name', 'test'), 'test');
  7. $this->assertEquals(System\Arr::get(array(), 'name', function() {return 'test';}), 'test');
  8. }
  9. public function testReturnsItemWhenPresentInArray()
  10. {
  11. $this->assertEquals(System\Arr::get(array('name' => 'test'), 'name'), 'test');
  12. }
  13. }