Пример #1
0
    public function testLoadDefaults()
    {
        $prevDefaultSource = $this->object->default_source;

        $this->object->default_source = 'unexisted.file.php';
        $this->assertFalse($this->object->loadDefaults());

        $this->object->default_source = $prevDefaultSource;

        include $this->object->default_source;

        $loadedConf = $cfg;
        unset($cfg);

        $this->assertTrue($this->object->loadDefaults());

        $this->assertEquals($this->object->default_source_mtime, filemtime($prevDefaultSource));
        $this->assertEquals($loadedConf['Servers'][1], $this->object->default_server);

        unset($loadedConf['Servers']);

        $this->assertEquals($loadedConf, $this->object->default);

        $expectedSettings = PMA_array_merge_recursive($this->object->settings, $loadedConf);

        $this->assertEquals($expectedSettings, $this->object->settings, 'Settings loaded wrong');

        $this->assertFalse($this->object->error_config_default_file);
    }