parent
16352fc10c
commit
b38e3affb9
|
@ -2,16 +2,16 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
use Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Web\Widget\Dashboard;
|
||||
use Icinga\Form\Dashboard\AddUrlForm;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Web\Controller\ActionController;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
use Icinga\File\Ini\IniWriter;
|
||||
use Icinga\Form\Dashboard\AddUrlForm;
|
||||
use Icinga\Web\Controller\ActionController;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Dashboard;
|
||||
|
||||
/**
|
||||
* Handle creation, removal and displaying of dashboards, panes and components
|
||||
|
@ -36,7 +36,7 @@ class DashboardController extends ActionController
|
|||
{
|
||||
$dashboard = new Dashboard();
|
||||
try {
|
||||
$dashboardConfig = IcingaConfig::app($config);
|
||||
$dashboardConfig = Config::app($config);
|
||||
if (count($dashboardConfig) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class DashboardController extends ActionController
|
|||
ltrim($form->getValue('url'), '/')
|
||||
);
|
||||
|
||||
$configFile = IcingaConfig::app('dashboard/dashboard')->getConfigFile();
|
||||
$configFile = Config::app('dashboard/dashboard')->getConfigFile();
|
||||
if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) {
|
||||
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane'))));
|
||||
} else {
|
||||
|
@ -125,7 +125,7 @@ class DashboardController extends ActionController
|
|||
$dashboard->activate($pane);
|
||||
}
|
||||
|
||||
$this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG);
|
||||
$this->view->configPath = Config::resolvePath(self::DEFAULT_CONFIG);
|
||||
|
||||
if ($dashboard === null) {
|
||||
$this->view->title = 'Dashboard';
|
||||
|
@ -158,7 +158,7 @@ class DashboardController extends ActionController
|
|||
*/
|
||||
protected function writeConfiguration(Zend_Config $config, $target)
|
||||
{
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
|
||||
try {
|
||||
$writer->write();
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Icinga\Form;
|
|||
use Exception;
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
use Icinga\File\Ini\IniWriter;
|
||||
|
||||
/**
|
||||
* Form base-class providing standard functionality for configuration forms
|
||||
|
@ -43,7 +43,7 @@ class ConfigForm extends Form
|
|||
*/
|
||||
public function save()
|
||||
{
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array(
|
||||
'config' => $this->config,
|
||||
'filename' => $this->config->getConfigFile()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Config;
|
||||
namespace Icinga\File\Ini;
|
||||
|
||||
/**
|
||||
* Edit the sections and keys of an ini in-place
|
|
@ -2,17 +2,16 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Config;
|
||||
namespace Icinga\File\Ini;
|
||||
|
||||
use Zend_Config;
|
||||
use Zend_Config_Ini;
|
||||
use Zend_Config_Writer_FileAbstract;
|
||||
use Icinga\Config\IniEditor;
|
||||
|
||||
/**
|
||||
* A ini file adapter that respects the file structure and the comments of already existing ini files
|
||||
* A INI file adapter that respects the file structure and the comments of already existing ini files
|
||||
*/
|
||||
class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
|
||||
class IniWriter extends Zend_Config_Writer_FileAbstract
|
||||
{
|
||||
/**
|
||||
* Stores the options
|
||||
|
@ -22,7 +21,7 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
|
|||
protected $options;
|
||||
|
||||
/**
|
||||
* Create a new PreservingIniWriter
|
||||
* Create a new INI writer
|
||||
*
|
||||
* @param array $options Supports all options of Zend_Config_Writer and additional
|
||||
* options for the internal IniEditor:
|
|
@ -5,12 +5,12 @@
|
|||
namespace Icinga\User\Preferences\Store;
|
||||
|
||||
use Zend_Config;
|
||||
use Icinga\Util\File;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
use Icinga\Exception\NotWritableError;
|
||||
use Icinga\File\Ini\IniWriter;
|
||||
use Icinga\User\Preferences;
|
||||
use Icinga\User\Preferences\PreferencesStore;
|
||||
use Icinga\Util\File;
|
||||
|
||||
/**
|
||||
* Load and save user preferences from and to INI files
|
||||
|
@ -34,7 +34,7 @@ class IniStore extends PreferencesStore
|
|||
/**
|
||||
* Writer which stores the preferences
|
||||
*
|
||||
* @var PreservingIniWriter
|
||||
* @var IniWriter
|
||||
*/
|
||||
protected $writer;
|
||||
|
||||
|
@ -114,7 +114,7 @@ class IniStore extends PreferencesStore
|
|||
);
|
||||
}
|
||||
|
||||
$this->writer = new PreservingIniWriter(
|
||||
$this->writer = new IniWriter(
|
||||
array(
|
||||
'config' => new Zend_Config($this->preferences),
|
||||
'filename' => $this->preferencesFile
|
||||
|
|
|
@ -6,10 +6,10 @@ namespace Tests\Icinga\Config;
|
|||
|
||||
use Zend_Config;
|
||||
use Zend_Config_Ini;
|
||||
use Icinga\File\Ini\IniWriter;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Config\PreservingIniWriter;
|
||||
|
||||
class PreservingIniWriterTest extends BaseTestCase
|
||||
class IniWriterTest extends BaseTestCase
|
||||
{
|
||||
protected $tempFile;
|
||||
protected $tempFile2;
|
||||
|
@ -34,22 +34,22 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('');
|
||||
$config = new Zend_Config(array('key' => 'value'));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals('value', $newConfig->get('key'), 'PreservingIniWriter does not insert in empty files');
|
||||
$this->assertEquals('value', $newConfig->get('key'), 'IniWriter does not insert in empty files');
|
||||
}
|
||||
|
||||
public function testWhetherSimplePropertiesAreInsertedInExistingFiles()
|
||||
{
|
||||
$target = $this->writeConfigToTemporaryFile('key1 = "1"');
|
||||
$config = new Zend_Config(array('key2' => '2'));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals('2', $newConfig->get('key2'), 'PreservingIniWriter does not insert in existing files');
|
||||
$this->assertEquals('2', $newConfig->get('key2'), 'IniWriter does not insert in existing files');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,11 +59,11 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('key = "value"');
|
||||
$config = new Zend_Config(array('key' => 'eulav'));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals('eulav', $newConfig->get('key'), 'PreservingIniWriter does not update simple properties');
|
||||
$this->assertEquals('eulav', $newConfig->get('key'), 'IniWriter does not update simple properties');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,30 +73,30 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('key = "value"');
|
||||
$config = new Zend_Config(array());
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull($newConfig->get('key'), 'PreservingIniWriter does not delete simple properties');
|
||||
$this->assertNull($newConfig->get('key'), 'IniWriter does not delete simple properties');
|
||||
}
|
||||
|
||||
public function testWhetherNestedPropertiesAreInserted()
|
||||
{
|
||||
$target = $this->writeConfigToTemporaryFile('');
|
||||
$config = new Zend_Config(array('a' => array('b' => 'c')));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('a'),
|
||||
'PreservingIniWriter does not insert nested properties'
|
||||
'IniWriter does not insert nested properties'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'c',
|
||||
$newConfig->get('a')->get('b'),
|
||||
'PreservingIniWriter does not insert nested properties'
|
||||
'IniWriter does not insert nested properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -107,19 +107,19 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('a.b = "c"');
|
||||
$config = new Zend_Config(array('a' => array('b' => 'cc')));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('a'),
|
||||
'PreservingIniWriter does not update nested properties'
|
||||
'IniWriter does not update nested properties'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'cc',
|
||||
$newConfig->get('a')->get('b'),
|
||||
'PreservingIniWriter does not update nested properties'
|
||||
'IniWriter does not update nested properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -130,13 +130,13 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('a.b = "c"');
|
||||
$config = new Zend_Config(array());
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull(
|
||||
$newConfig->get('a'),
|
||||
'PreservingIniWriter does not delete nested properties'
|
||||
'IniWriter does not delete nested properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -144,19 +144,19 @@ class PreservingIniWriterTest extends BaseTestCase
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('');
|
||||
$config = new Zend_Config(array('section' => array('key' => 'value')));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('section'),
|
||||
'PreservingIniWriter does not insert sections'
|
||||
'IniWriter does not insert sections'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'value',
|
||||
$newConfig->get('section')->get('key'),
|
||||
'PreservingIniWriter does not insert simple section properties'
|
||||
'IniWriter does not insert simple section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -171,14 +171,14 @@ key = "value"
|
|||
EOD
|
||||
);
|
||||
$config = new Zend_Config(array('section' => array('key' => 'eulav')));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals(
|
||||
'eulav',
|
||||
$newConfig->get('section')->get('key'),
|
||||
'PreservingIniWriter does not update simple section properties'
|
||||
'IniWriter does not update simple section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -193,13 +193,13 @@ key = "value"
|
|||
EOD
|
||||
);
|
||||
$config = new Zend_Config(array('section' => array()));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull(
|
||||
$newConfig->get('section')->get('key'),
|
||||
'PreservingIniWriter does not delete simple section properties'
|
||||
'IniWriter does not delete simple section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -207,24 +207,24 @@ EOD
|
|||
{
|
||||
$target = $this->writeConfigToTemporaryFile('');
|
||||
$config = new Zend_Config(array('section' => array('a' => array('b' => 'c'))));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('section'),
|
||||
'PreservingIniWriter does not insert sections'
|
||||
'IniWriter does not insert sections'
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('section')->get('a'),
|
||||
'PreservingIniWriter does not insert nested section properties'
|
||||
'IniWriter does not insert nested section properties'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'c',
|
||||
$newConfig->get('section')->get('a')->get('b'),
|
||||
'PreservingIniWriter does not insert nested section properties'
|
||||
'IniWriter does not insert nested section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -239,14 +239,14 @@ a.b = "c"
|
|||
EOD
|
||||
);
|
||||
$config = new Zend_Config(array('section' => array('a' => array('b' => 'cc'))));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals(
|
||||
'cc',
|
||||
$newConfig->get('section')->get('a')->get('b'),
|
||||
'PreservingIniWriter does not update nested section properties'
|
||||
'IniWriter does not update nested section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -261,13 +261,13 @@ a.b = "c"
|
|||
EOD
|
||||
);
|
||||
$config = new Zend_Config(array('section' => array()));
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull(
|
||||
$newConfig->get('section')->get('a'),
|
||||
'PreservingIniWriter does not delete nested section properties'
|
||||
'IniWriter does not delete nested section properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -281,29 +281,29 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('foo'),
|
||||
'PreservingIniWriter does not insert extended sections'
|
||||
'IniWriter does not insert extended sections'
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('bar'),
|
||||
'PreservingIniWriter does not insert extending sections'
|
||||
'IniWriter does not insert extending sections'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'2',
|
||||
$newConfig->get('bar')->get('key2'),
|
||||
'PreservingIniWriter does not insert simple properties into extending sections'
|
||||
'IniWriter does not insert simple properties into extending sections'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'1',
|
||||
$newConfig->get('foo')->get('key1'),
|
||||
'PreservingIniWriter does not properly define extending sections'
|
||||
'IniWriter does not properly define extending sections'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -327,14 +327,14 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals(
|
||||
'22',
|
||||
$newConfig->get('bar')->get('key2'),
|
||||
'PreservingIniWriter does not update simple properties of extending sections'
|
||||
'IniWriter does not update simple properties of extending sections'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -358,13 +358,13 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull(
|
||||
$newConfig->get('bar')->get('key2'),
|
||||
'PreservingIniWriter does not delete simple properties of extending sections'
|
||||
'IniWriter does not delete simple properties of extending sections'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -378,34 +378,34 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('foo'),
|
||||
'PreservingIniWriter does not insert extended sections'
|
||||
'IniWriter does not insert extended sections'
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('bar'),
|
||||
'PreservingIniWriter does not insert extending sections'
|
||||
'IniWriter does not insert extending sections'
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\Zend_Config',
|
||||
$newConfig->get('bar')->get('d'),
|
||||
'PreservingIniWriter does not insert nested properties into extending sections'
|
||||
'IniWriter does not insert nested properties into extending sections'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'f',
|
||||
$newConfig->get('bar')->get('d')->get('e'),
|
||||
'PreservingIniWriter does not insert nested properties into extending sections'
|
||||
'IniWriter does not insert nested properties into extending sections'
|
||||
);
|
||||
$this->assertEquals(
|
||||
'c',
|
||||
$newConfig->get('bar')->get('a')->get('b'),
|
||||
'PreservingIniWriter does not properly define extending sections with nested properties'
|
||||
'IniWriter does not properly define extending sections with nested properties'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -429,14 +429,14 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertEquals(
|
||||
'ff',
|
||||
$newConfig->get('bar')->get('d')->get('e'),
|
||||
'PreservingIniWriter does not update nested properties of extending sections'
|
||||
'IniWriter does not update nested properties of extending sections'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -460,13 +460,13 @@ EOD
|
|||
)
|
||||
);
|
||||
$config->setExtend('bar', 'foo');
|
||||
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer = new IniWriter(array('config' => $config, 'filename' => $target));
|
||||
$writer->write();
|
||||
|
||||
$newConfig = new Zend_Config_Ini($target);
|
||||
$this->assertNull(
|
||||
$newConfig->get('bar')->get('d'),
|
||||
'PreservingIniWriter does not delete nested properties of extending sections'
|
||||
'IniWriter does not delete nested properties of extending sections'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ key1 = "1"
|
|||
key2 = "2"
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array(
|
||||
'config' => new Zend_Config(
|
||||
array(
|
||||
|
@ -535,7 +535,7 @@ EOD;
|
|||
$this->assertEquals(
|
||||
trim($reverted),
|
||||
trim($writer->render()),
|
||||
'PreservingIniWriter does not preserve section and/or property order'
|
||||
'IniWriter does not preserve section and/or property order'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ EOD;
|
|||
[one]
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array(
|
||||
'config' => new Zend_Config(
|
||||
array(
|
||||
|
@ -574,7 +574,7 @@ EOD;
|
|||
$this->assertEquals(
|
||||
trim($reverted),
|
||||
trim($writer->render()),
|
||||
'PreservingIniWriter does not preserve section and/or property order'
|
||||
'IniWriter does not preserve section and/or property order'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -588,14 +588,14 @@ key = "value"
|
|||
; boring comment
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array('config' => new Zend_Config(array('key' => 'value')), 'filename' => $target)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$config,
|
||||
$writer->render(),
|
||||
'PreservingIniWriter does not preserve comments on empty lines'
|
||||
'IniWriter does not preserve comments on empty lines'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ key = "value" ; some comment for a small sized pro
|
|||
xxl = "very loooooooooooooooooooooong" ; my value is very lo...
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array(
|
||||
'config' => new Zend_Config(
|
||||
array(
|
||||
|
@ -625,7 +625,7 @@ EOD;
|
|||
$this->assertEquals(
|
||||
$config,
|
||||
$writer->render(),
|
||||
'PreservingIniWriter does not preserve comments on property lines'
|
||||
'IniWriter does not preserve comments on property lines'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -637,14 +637,14 @@ EOD;
|
|||
key = "value"
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array('config' => new Zend_Config(array('section' => array('key' => 'value'))), 'filename' => $target)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$config,
|
||||
$writer->render(),
|
||||
'PreservingIniWriter does not preserve comments on empty section lines'
|
||||
'IniWriter does not preserve comments on empty section lines'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ key = "value" ; some comment for a small sized pro
|
|||
xxl = "very loooooooooooooooooooooong" ; my value is very lo...
|
||||
EOD;
|
||||
$target = $this->writeConfigToTemporaryFile($config);
|
||||
$writer = new PreservingIniWriter(
|
||||
$writer = new IniWriter(
|
||||
array(
|
||||
'config' => new Zend_Config(
|
||||
array(
|
||||
|
@ -677,13 +677,13 @@ EOD;
|
|||
$this->assertEquals(
|
||||
$config,
|
||||
$writer->render(),
|
||||
'PreservingIniWriter does not preserve comments on property lines'
|
||||
'IniWriter does not preserve comments on property lines'
|
||||
);
|
||||
}
|
||||
|
||||
public function testKeyNormalization()
|
||||
{
|
||||
$normalKeys = new PreservingIniWriter(
|
||||
$normalKeys = new IniWriter(
|
||||
array (
|
||||
'config' => new Zend_Config(array (
|
||||
'foo' => 'bar',
|
||||
|
@ -704,7 +704,7 @@ EOD;
|
|||
|
||||
);
|
||||
|
||||
$nestedKeys = new PreservingIniWriter(
|
||||
$nestedKeys = new IniWriter(
|
||||
array (
|
||||
'config' => new Zend_Config(array (
|
||||
'foo' => 'bar',
|
Loading…
Reference in New Issue