diff --git a/test/php/library/Icinga/Config/PreservingIniWriterTest.php b/test/php/library/Icinga/Config/PreservingIniWriterTest.php index 277dec086..b69bc4d1c 100644 --- a/test/php/library/Icinga/Config/PreservingIniWriterTest.php +++ b/test/php/library/Icinga/Config/PreservingIniWriterTest.php @@ -467,7 +467,7 @@ EOD ); } - public function testWhetherSectionAndPropertyOrderIsUpdated() + public function testWhetherSectionOrderIsUpdated() { $config = <<<'EOD' [one] @@ -536,6 +536,46 @@ EOD; ); } + public function testWhetherCommentOrderIsUpdated() + { + $config = <<<'EOD' +; comment 1 +[one] + + +; comment 2 +[two] +EOD; + + $reverted = <<<'EOD' +; comment 2 +[two] + + +; comment 1 +[one] +EOD; + $target = $this->writeConfigToTemporaryFile($config); + $writer = new PreservingIniWriter( + array( + 'config' => new Zend_Config( + array( + 'two' => array(), + 'one' => array() + ) + ), + 'filename' => $target + ) + ); + + $this->assertEquals( + trim($reverted), + trim($writer->render()), + 'PreservingIniWriter does not preserve section and/or property order' + ); + } + + public function testWhetherCommentsOnEmptyLinesArePreserved() { $config = <<<'EOD'