diff --git a/tests/functions/parse_cfg_file_test.php b/tests/functions/parse_cfg_file_test.php new file mode 100644 index 0000000000..daa0062c96 --- /dev/null +++ b/tests/functions/parse_cfg_file_test.php @@ -0,0 +1,97 @@ + 'prosilver', + 'copyright' => '© phpBB Group, 2007', + 'version' => '3.0.12', + ), + ), + array( + 'name = subsilver2 +copyright = © 2005 phpBB Group +version = 3.0.12', + array( + 'name' => 'subsilver2', + 'copyright' => '© 2005 phpBB Group', + 'version' => '3.0.12', + ), + ), + array( + 'foo = yes +foo1 = true +foo2 = 1 +bar = no +bar1 = false +bar2 = 0 +foobar = +foobar1 = "asdf" +foobar2 = \'qwer\'', + array( + 'foo' => true, + 'foo1' => true, + 'foo2' => true, + 'bar' => false, + 'bar1' => false, + 'bar2' => false, + 'foobar' => '', + 'foobar1' => 'asdf', + 'foobar2' => 'qwer', + ), + ), + array( + 'foo = & bar +bar = Test', + array( + 'foo' => '&amp; bar', + 'bar' => '<a href='test'>Test</a>', + ), + ), + ); + } + + /** + * @dataprovider parse_cfg_file_data + */ + public function test_parse_cfg_file($file_contents, $expected) + { + $lines = explode("\n", $file_contents); + $this->assertEquals($expected, parse_cfg_file(false, $lines)); + } +}