mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-19 09:48:53 +00:00
[ticket/11604] Skip installer step where config.php is created.
PHPBB3-11604
This commit is contained in:
parent
21f839494d
commit
1af6dc22e2
1 changed files with 27 additions and 20 deletions
|
@ -220,10 +220,12 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
self::assertContains('Welcome to Installation', $crawler->filter('#main')->text());
|
self::assertContains('Welcome to Installation', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=requirements
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('Installation compatibility', $crawler->filter('#main')->text());
|
self::assertContains('Installation compatibility', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=database
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('Database configuration', $crawler->filter('#main')->text());
|
self::assertContains('Database configuration', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form(array(
|
$form = $crawler->selectButton('submit')->form(array(
|
||||||
|
@ -237,10 +239,12 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
'table_prefix' => self::$config['table_prefix'],
|
'table_prefix' => self::$config['table_prefix'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=database
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('Successful connection', $crawler->filter('#main')->text());
|
self::assertContains('Successful connection', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=administrator
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('Administrator configuration', $crawler->filter('#main')->text());
|
self::assertContains('Administrator configuration', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form(array(
|
$form = $crawler->selectButton('submit')->form(array(
|
||||||
|
@ -252,38 +256,38 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
'board_email2' => 'nobody@example.com',
|
'board_email2' => 'nobody@example.com',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=administrator
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('Tests passed', $crawler->filter('#main')->text());
|
self::assertContains('Tests passed', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
|
||||||
$crawler = self::submit($form);
|
// We have to skip install/index.php?mode=install&sub=config_file
|
||||||
$config_writable = strpos($crawler->filter('#main')->text(), 'It was not possible to write the configuration file.') === false;
|
// because that step will create a config.php file if phpBB has the
|
||||||
|
// permission to do so. We have to create the config file on our own
|
||||||
|
// in order to get the DEBUG constants defined.
|
||||||
$config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], array(), true, true);
|
$config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], array(), true, true);
|
||||||
|
$config_created = file_put_contents($config_file, $config_php_data) !== false;
|
||||||
if (!$config_writable)
|
if (!$config_created)
|
||||||
{
|
{
|
||||||
// phpBB could not write to the config.php file, so we have to "Download" it.
|
self::markTestSkipped("Could not write $config_file file.");
|
||||||
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());
|
// We also have to create a install lock that is normally created by
|
||||||
|
// the installer. The file will be removed by the final step of the
|
||||||
// Overwrite the config.php file generated by phpBB in order to get the
|
// installer.
|
||||||
// DEBUG constants defined if possible. It should be possible when unit
|
$install_lock_file = $phpbb_root_path . 'cache/install_lock';
|
||||||
// tests run as the same user as phpBB.
|
$lock_created = file_put_contents($install_lock_file, '') !== false;
|
||||||
if ($config_writable && is_writable($config_file))
|
if (!$lock_created)
|
||||||
{
|
{
|
||||||
file_put_contents($config_file, $config_php_data);
|
self::markTestSkipped("Could not create $lock_created file.");
|
||||||
}
|
}
|
||||||
|
@chmod($install_lock_file, 0666);
|
||||||
|
|
||||||
$form = $crawler->selectButton('submit')->form();
|
// install/index.php?mode=install&sub=advanced
|
||||||
|
$form_data = $form->getValues();
|
||||||
|
unset($form_data['submit']);
|
||||||
|
|
||||||
$crawler = self::submit($form);
|
$crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data);
|
||||||
self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text());
|
self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form(array(
|
$form = $crawler->selectButton('submit')->form(array(
|
||||||
'email_enable' => true,
|
'email_enable' => true,
|
||||||
|
@ -300,13 +304,16 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
'script_path' => $parseURL['path'],
|
'script_path' => $parseURL['path'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=create_table
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text());
|
self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text());
|
||||||
self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text());
|
self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text());
|
||||||
$form = $crawler->selectButton('submit')->form();
|
$form = $crawler->selectButton('submit')->form();
|
||||||
|
|
||||||
|
// install/index.php?mode=install&sub=final
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
self::assertContains('You have successfully installed', $crawler->text());
|
self::assertContains('You have successfully installed', $crawler->text());
|
||||||
|
|
||||||
copy($config_file, $config_file_test);
|
copy($config_file, $config_file_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue