1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[ticket/11604] Fix case where config.php is not generated by phpBB.

PHPBB3-11604
This commit is contained in:
Andreas Fischer 2013-06-18 15:21:28 +02:00
parent 516581c41e
commit 21f839494d

View File

@ -257,8 +257,30 @@ class phpbb_functional_test_case extends phpbb_test_case
$form = $crawler->selectButton('submit')->form();
$crawler = self::submit($form);
$config_writable = strpos($crawler->filter('#main')->text(), 'It was not possible to write the configuration file.') === false;
$config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], array(), true, true);
if (!$config_writable)
{
// phpBB could not write to the config.php file, so we have to "Download" it.
self::assertContains('Download config', $crawler->filter('#main')->text());
file_put_contents($config_file, $config_php_data);
$form = $crawler->selectButton('dldone')->form();
$crawler = self::submit($form);
}
self::assertContains('The configuration file has been written.', $crawler->filter('#main')->text());
file_put_contents($config_file, phpbb_create_config_file_data(self::$config, self::$config['dbms'], array(), true, true));
// Overwrite the config.php file generated by phpBB in order to get the
// DEBUG constants defined if possible. It should be possible when unit
// tests run as the same user as phpBB.
if ($config_writable && is_writable($config_file))
{
file_put_contents($config_file, $config_php_data);
}
$form = $crawler->selectButton('submit')->form();
$crawler = self::submit($form);