Browse Source

added arr tests.

Taylor Otwell 13 years ago
parent
commit
ca3c6623a2
1 changed files with 17 additions and 0 deletions
  1. 17 0
      tests/suite/ArrTest.php

+ 17 - 0
tests/suite/ArrTest.php

@@ -0,0 +1,17 @@
+<?php
+
+class ArrTest extends PHPUnit_Framework_TestCase {
+
+	public function testReturnsDefaultWhenItemNotPresentInArray()
+	{
+		$this->assertNull(System\Arr::get(array(), 'name'));
+		$this->assertEquals(System\Arr::get(array(), 'name', 'test'), 'test');
+		$this->assertEquals(System\Arr::get(array(), 'name', function() {return 'test';}), 'test');
+	}
+
+	public function testReturnsItemWhenPresentInArray()
+	{
+		$this->assertEquals(System\Arr::get(array('name' => 'test'), 'name'), 'test');
+	}
+
+}