Exemplo n.º 1
0
    /**
     * @group ZF-6289
     */
    public function testZF6289_NonSectionElementsAndSectionJumbling()
    {
        $config = new \Zend\Config\Config(array(
            'one'   => 'element',
            'two'   => array('type' => 'section'),
            'three' => 'element',
            'four'  => array('type' => 'section'),
            'five'  => 'element'
        ));
        
        $writer = new \Zend\Config\Writer\Ini;
        $iniString = $writer->setConfig($config)->render($config);
        
        $expected = <<<ECS
one = "element"
three = "element"
five = "element"
[two]
type = "section"

[four]
type = "section"


ECS;
        
        $this->assertEquals(
            $expected,
            $iniString
        );
    }
Exemplo n.º 2
0
    public function testRenderWithoutSections2()
    {
        $config = new IniConfig(__DIR__ . '/files/allsections.ini', null, array('skipExtends' => true));

        $writer = new Ini();
        $writer->setRenderWithoutSections();
        $iniString = $writer->setConfig($config)->render();

        $expected = <<<ECS
all.hostname = "all"
all.name = "thisname"
all.db.host = "127.0.0.1"
all.db.user = "******"
all.db.pass = "******"
all.db.name = "live"
all.one.two.three = "multi"
staging.hostname = "staging"
staging.db.name = "dbstaging"
staging.debug = ""
debug.hostname = "debug"
debug.debug = "1"
debug.values.changed = "1"
debug.db.name = "dbdebug"
debug.special.no = ""
debug.special.null = ""
debug.special.false = ""
other_staging.only_in = "otherStaging"
other_staging.db.pass = "******"

ECS;
        $this->assertEquals($expected, $iniString);
    }