| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
regression test for bug #3137
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
|
|
|
6 |
$array = array("foo", "bar", "too"); // the source of the config to write.
|
|
|
7 |
|
|
|
8 |
$root =& $config->parseConfig($array, "phparray");
|
|
|
9 |
if (PEAR::isError($root)) {
|
|
|
10 |
die('Error while reading configuration: ' . $root->getMessage() . "\r\n");
|
|
|
11 |
}
|
|
|
12 |
|
|
|
13 |
$result = $root->createComment("Comment", "before", $root->children[0]);
|
|
|
14 |
if (PEAR::isError($result)) {
|
|
|
15 |
die('Error while reading configuration: ' . $result->getMessage() . "\r\n");
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
$exp = '// Comment
|
|
|
19 |
$conf[0] = \'foo\';
|
|
|
20 |
$conf[1] = \'bar\';
|
|
|
21 |
$conf[2] = \'too\';
|
|
|
22 |
';
|
|
|
23 |
|
|
|
24 |
//print_r($root->toString('phparray'));
|
|
|
25 |
if ($phpt->assertNoErrors('problem!')) {
|
|
|
26 |
$phpt->assertEquals($root->toString('phparray'), $exp, 'uh oh');
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
echo 'tests done';
|
|
|
30 |
?>
|
|
|
31 |
--EXPECT--
|
|
|
32 |
tests done
|