validate( (object) array() ); $this->assertFalse( false, $result ); } /** * Test it can get value by index */ public function test_it_can_get_value_by_index() { $arguments = (object) array( 'path' => '0' ); $dot_notation = new DotNotation(); $item = array( 'name' => 'test' ); $items = array( $item ); $result = $dot_notation->transform( $items, $arguments ); $this->assertEquals( $result, $item ); } /** * Test it get getvalue by dot notation. */ public function test_it_can_get_value_by_dot_notation() { $arguments = (object) array( 'path' => 'teams.mothra' ); $items = array( 'teams' => array( 'mothra' => 'nice!', ), ); $dot_notation = new DotNotation(); $result = $dot_notation->transform( $items, $arguments ); $this->assertEquals( 'nice!', $result ); } /** * Test it returns default value when path is undefined */ public function test_it_can_get_default_value_by_dot_notation() { $arguments = (object) array( 'path' => 'teams.property_that_does_not_exist' ); $items = array( 'teams' => array( 'mothra' => 'nice!', ), ); $dot_notation = new DotNotation(); $default = 'default value'; $result = $dot_notation->transform( $items, $arguments, $default ); $this->assertEquals( $default, $result ); } }