aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2013-06-18 15:21:28 +0200
committerAndreas Fischer <bantu@phpbb.com>2013-06-18 16:02:33 +0200
commit21f839494ddb55d1c4aefeed113b5debe9b2e1b3 (patch)
tree983a99cb63942159654a6da24dcd68ad6ad29621 /tests/test_framework
parent516581c41edaa5f565ef90bac14cdbdc054e7914 (diff)
downloadforums-21f839494ddb55d1c4aefeed113b5debe9b2e1b3.tar
forums-21f839494ddb55d1c4aefeed113b5debe9b2e1b3.tar.gz
forums-21f839494ddb55d1c4aefeed113b5debe9b2e1b3.tar.bz2
forums-21f839494ddb55d1c4aefeed113b5debe9b2e1b3.tar.xz
forums-21f839494ddb55d1c4aefeed113b5debe9b2e1b3.zip
[ticket/11604] Fix case where config.php is not generated by phpBB.
PHPBB3-11604
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 1b47cbe125..16ed9f5a1e 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -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);