[ticket/12202] Use an array in the data provider instead of exploding manually

PHPBB3-12202
This commit is contained in:
Joas Schilling 2014-03-14 13:18:30 +01:00
parent f3d8dfd1e3
commit 1f8ab1c196

View file

@ -15,28 +15,29 @@ class phpbb_functions_parse_cfg_file extends phpbb_test_case
{ {
return array( return array(
array( array(
'# array(
# phpBB Style Configuration File '#',
# '# phpBB Style Configuration File',
# @package phpBB3 '#',
# @copyright (c) 2005 phpBB Group '# @package phpBB3',
# @license http://opensource.org/licenses/gpl-license.php GNU Public License '# @copyright (c) 2005 phpBB Group',
# '# @license http://opensource.org/licenses/gpl-license.php GNU Public License',
# '#',
# At the left is the name, please do not change this '#',
# At the right the value is entered '# At the left is the name, please do not change this',
# For on/off options the valid values are on, off, 1, 0, true and false '# At the right the value is entered',
# '# For on/off options the valid values are on, off, 1, 0, true and false',
# Values get trimmed, if you want to add a space in front or at the end of '#',
# the value, then enclose the value with single or double quotes. '# Values get trimmed, if you want to add a space in front or at the end of',
# Single and double quotes do not need to be escaped. '# the value, then enclose the value with single or double quotes.',
# '# Single and double quotes do not need to be escaped.',
# '#',
'',
# General Information about this style '# General Information about this style',
name = prosilver 'name = prosilver',
copyright = © phpBB Group, 2007 'copyright = © phpBB Group, 2007',
version = 3.0.12', 'version = 3.0.12',
),
array( array(
'name' => 'prosilver', 'name' => 'prosilver',
'copyright' => '© phpBB Group, 2007', 'copyright' => '© phpBB Group, 2007',
@ -44,9 +45,11 @@ version = 3.0.12',
), ),
), ),
array( array(
'name = subsilver2 array(
copyright = © 2005 phpBB Group 'name = subsilver2',
version = 3.0.12', 'copyright = © 2005 phpBB Group',
'version = 3.0.12',
),
array( array(
'name' => 'subsilver2', 'name' => 'subsilver2',
'copyright' => '© 2005 phpBB Group', 'copyright' => '© 2005 phpBB Group',
@ -54,15 +57,17 @@ version = 3.0.12',
), ),
), ),
array( array(
'foo = on array(
foo1 = true 'foo = on',
foo2 = 1 'foo1 = true',
bar = off 'foo2 = 1',
bar1 = false 'bar = off',
bar2 = 0 'bar1 = false',
foobar = 'bar2 = 0',
foobar1 = "asdf" 'foobar =',
foobar2 = \'qwer\'', 'foobar1 = "asdf"',
'foobar2 = \'qwer\'',
),
array( array(
'foo' => true, 'foo' => true,
'foo1' => true, 'foo1' => true,
@ -76,8 +81,10 @@ foobar2 = \'qwer\'',
), ),
), ),
array( array(
'foo = & bar array(
bar = <a href="test">Test</a>', 'foo = &amp; bar',
'bar = <a href="test">Test</a>',
),
array( array(
'foo' => '&amp;amp; bar', 'foo' => '&amp;amp; bar',
'bar' => '&lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt;', 'bar' => '&lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt;',
@ -91,7 +98,6 @@ bar = <a href="test">Test</a>',
*/ */
public function test_parse_cfg_file($file_contents, $expected) public function test_parse_cfg_file($file_contents, $expected)
{ {
$lines = explode("\n", $file_contents); $this->assertEquals($expected, parse_cfg_file(false, $file_contents));
$this->assertEquals($expected, parse_cfg_file(false, $lines));
} }
} }