/** * @covers Fuel\Common\Arr::subset * @group Common */ public function testSubset() { $input = array("user" => array("name" => "John", "surname" => "Lastname"), "project" => array("name" => "Fuel", "type" => "Framework")); $expected = array('project' => array('name' => 'Fuel'), 'user' => array('name' => 'John')); $result = Arr::subset($input, array('project.name', 'user.name')); $this->assertEquals($expected, $result); $expected = array('project' => array('name' => 'Fuel', 'manager' => null)); $result = Arr::subset($input, array('project.name', 'project.manager')); $this->assertEquals($expected, $result); $expected = array('project' => array('name' => 'Fuel', 'manager' => 'Not Provided'), 'user' => array('name' => 'John', 'surname' => 'Lastname'), 'not_provided' => 'Not Provided'); $result = Arr::subset($input, array('project.name', 'project.manager', 'user', 'not_provided'), 'Not Provided'); $this->assertEquals($expected, $result); }