'Value 1', 'field2' => 35, 'field3' => 123123), array('field1' => 'Value 1', 'field2' => "Value\nline 2", 'field3' => 'Value 3'), ), '"field1","field2","field3" "Value 1","35","123123" "Value 1","Value line 2","Value 3"', ), ); } /** * Test for Format::forge($foo, 'csv')->to_array() * * @test * @dataProvider array_provider */ public function test_from_csv($array, $csv) { $this->assertEquals($array, Format::forge($csv, 'csv')->to_array()); } /** * Test for Format::forge($foo)->to_csv() * * @test * @dataProvider array_provider */ public function test_to_csv($array, $csv) { $this->assertEquals($csv, Format::forge($array)->to_csv()); } /** * Test for Format::forge($foo)->_from_xml() * * @test */ public function test__from_xml() { $xml = ' ../core/tests ../packages/*/tests ../app/tests '; $expected = array ( '@attributes' => array ( 'colors' => 'true', 'stopOnFailure' => 'false', 'bootstrap' => 'bootstrap_phpunit.php', ), 'php' => array ( 'server' => array ( 0 => array ( '@attributes' => array ( 'name' => 'doc_root', 'value' => '../../', ), ), 1 => array ( '@attributes' => array ( 'name' => 'app_path', 'value' => 'fuel/app', ), ), 2 => array ( '@attributes' => array ( 'name' => 'core_path', 'value' => 'fuel/core', ), ), 3 => array ( '@attributes' => array ( 'name' => 'package_path', 'value' => 'fuel/packages', ), ), ), ), 'testsuites' => array ( 'testsuite' => array ( 0 => array ( '@attributes' => array ( 'name' => 'core', ), 'directory' => '../core/tests', ), 1 => array ( '@attributes' => array ( 'name' => 'packages', ), 'directory' => '../packages/*/tests', ), 2 => array ( '@attributes' => array ( 'name' => 'app', ), 'directory' => '../app/tests', ), ), ), ); $this->assertEquals(Format::forge($expected)->to_php(), Format::forge($xml, 'xml')->to_php()); } function test_to_array_empty() { $array = null; $expected = array(); $this->assertEquals($expected, Format::forge($array)->to_array()); } }