@@ -24,45 +24,45 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class GetValueTest extends \PHPUnit_Framework_TestCase |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - */ |
|
| 29 | - public function testReturnsValueFromKey() |
|
| 30 | - { |
|
| 31 | - $key = 'foo'; |
|
| 32 | - $array = array($key => 'bar'); |
|
| 33 | - $this->assertEquals( |
|
| 34 | - $array[$key], |
|
| 35 | - ArrayUtil::get($key, $array) |
|
| 36 | - ); |
|
| 37 | - } |
|
| 27 | + /** |
|
| 28 | + */ |
|
| 29 | + public function testReturnsValueFromKey() |
|
| 30 | + { |
|
| 31 | + $key = 'foo'; |
|
| 32 | + $array = array($key => 'bar'); |
|
| 33 | + $this->assertEquals( |
|
| 34 | + $array[$key], |
|
| 35 | + ArrayUtil::get($key, $array) |
|
| 36 | + ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @depends Axstrad\Common\Tests\Util\ArrayUtil\DecompilePathTest::testCanParseDotNotation |
|
| 41 | - */ |
|
| 42 | - public function testReturnsValueByPath() |
|
| 43 | - { |
|
| 44 | - $array = array('one' => array('two'=>'three')); |
|
| 45 | - $this->assertEquals( |
|
| 46 | - 'three', |
|
| 47 | - ArrayUtil::get('one.two', $array) |
|
| 48 | - ); |
|
| 49 | - } |
|
| 39 | + /** |
|
| 40 | + * @depends Axstrad\Common\Tests\Util\ArrayUtil\DecompilePathTest::testCanParseDotNotation |
|
| 41 | + */ |
|
| 42 | + public function testReturnsValueByPath() |
|
| 43 | + { |
|
| 44 | + $array = array('one' => array('two'=>'three')); |
|
| 45 | + $this->assertEquals( |
|
| 46 | + 'three', |
|
| 47 | + ArrayUtil::get('one.two', $array) |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - */ |
|
| 53 | - public function testReturnsNullWhenKeyDoesntExist() |
|
| 54 | - { |
|
| 55 | - $this->assertNull( |
|
| 56 | - ArrayUtil::get('one', array('foo'=>'bar')) |
|
| 57 | - ); |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + */ |
|
| 53 | + public function testReturnsNullWhenKeyDoesntExist() |
|
| 54 | + { |
|
| 55 | + $this->assertNull( |
|
| 56 | + ArrayUtil::get('one', array('foo'=>'bar')) |
|
| 57 | + ); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - */ |
|
| 62 | - public function testReturnsDefaultValueWhenKeyDoesntExist() |
|
| 63 | - { |
|
| 64 | - $this->assertFalse( |
|
| 65 | - ArrayUtil::get('one', array('foo'=>'bar'), false) |
|
| 66 | - ); |
|
| 67 | - } |
|
| 60 | + /** |
|
| 61 | + */ |
|
| 62 | + public function testReturnsDefaultValueWhenKeyDoesntExist() |
|
| 63 | + { |
|
| 64 | + $this->assertFalse( |
|
| 65 | + ArrayUtil::get('one', array('foo'=>'bar'), false) |
|
| 66 | + ); |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -26,33 +26,33 @@ |
||
| 26 | 26 | { |
| 27 | 27 | /** |
| 28 | 28 | */ |
| 29 | - public function testCanParseDotNotation() |
|
| 30 | - { |
|
| 31 | - $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one.two.three')); |
|
| 32 | - } |
|
| 29 | + public function testCanParseDotNotation() |
|
| 30 | + { |
|
| 31 | + $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one.two.three')); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | */ |
| 36 | - public function testCanParseArrayNotation() |
|
| 37 | - { |
|
| 38 | - $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('[one][two][three]')); |
|
| 39 | - } |
|
| 36 | + public function testCanParseArrayNotation() |
|
| 37 | + { |
|
| 38 | + $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('[one][two][three]')); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | */ |
| 43 | - public function testCanParseArrayNotation2() |
|
| 44 | - { |
|
| 45 | - $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one[two][three]')); |
|
| 46 | - } |
|
| 43 | + public function testCanParseArrayNotation2() |
|
| 44 | + { |
|
| 45 | + $this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one[two][three]')); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @uses Axstrad\Common\Util\Debug |
| 50 | 50 | * @uses Axstrad\Common\Exception\InvalidArgumentException::create |
| 51 | 51 | */ |
| 52 | - public function testExpectException() |
|
| 53 | - { |
|
| 54 | - $this->setExpectedException('Axstrad\Common\Exception\InvalidArgumentException'); |
|
| 52 | + public function testExpectException() |
|
| 53 | + { |
|
| 54 | + $this->setExpectedException('Axstrad\Common\Exception\InvalidArgumentException'); |
|
| 55 | 55 | |
| 56 | - ArrayUtil::decompilePath(new \StdClass); |
|
| 57 | - } |
|
| 56 | + ArrayUtil::decompilePath(new \StdClass); |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -51,14 +51,14 @@ |
||
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | */ |
| 54 | - public function testReturnsFalseForNumericallyIndexedArray() |
|
| 55 | - { |
|
| 56 | - $this->assertFalse( |
|
| 57 | - ArrayUtil::isAssociative(array( |
|
| 58 | - 1 => 'one', |
|
| 59 | - 2 => 'two', |
|
| 60 | - 3 => 'three', |
|
| 61 | - )) |
|
| 62 | - ); |
|
| 63 | - } |
|
| 54 | + public function testReturnsFalseForNumericallyIndexedArray() |
|
| 55 | + { |
|
| 56 | + $this->assertFalse( |
|
| 57 | + ArrayUtil::isAssociative(array( |
|
| 58 | + 1 => 'one', |
|
| 59 | + 2 => 'two', |
|
| 60 | + 3 => 'three', |
|
| 61 | + )) |
|
| 62 | + ); |
|
| 63 | + } |
|
| 64 | 64 | } |