diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php index 9910cb5a08..f436587fb5 100644 --- a/phpBB/phpbb/composer/installer.php +++ b/phpBB/phpbb/composer/installer.php @@ -152,7 +152,9 @@ class installer { if (!$io) { + $this->restore_cwd(); $io = new null_io(); + $this->move_to_root(); } $this->generate_ext_json_file($packages); @@ -183,6 +185,7 @@ class installer } catch (\Exception $e) { + $this->restore_cwd(); $this->restore_ext_json_file(); throw new runtime_exception('COMPOSER_CANNOT_INSTALL', [], $e); @@ -190,6 +193,7 @@ class installer if ($result !== 0) { + $this->restore_cwd(); $this->restore_ext_json_file(); throw new runtime_exception($io->get_composer_error(), []); diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index ab02831209..ee5d82ff0e 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -76,7 +76,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->login(); $this->admin_login(); - $this->add_lang('acp/extensions'); + $this->add_lang(['acp/common', 'acp/extensions']); } public function test_list() @@ -264,4 +264,20 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case // Ensure catalog has any records in extensions list $this->assertGreaterThan(0, $crawler->filter('tbody > tr > td > strong')->count()); } + + public function test_extensions_catalog_installing_extension() + { + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=catalog&sid=' . $this->sid); + $this->assertContainsLang('ACP_EXTENSIONS_CATALOG', $this->get_content()); + + // Ensure catalog has any records in extensions list + $this->assertGreaterThan(0, $crawler->filter('tbody > tr > td > strong')->count()); + + // Attempt to install any extension which is 1st in the list + $extension_install_link = $crawler->filter('tbody')->selectLink($this->lang('INSTALL'))->link(); + $crawler = self::$client->click($extension_install_link); + + // Assert any action result is presented regardless of success + $this->assertTrue(strlen($crawler->filter('.console-output > pre')->text()) > 0, $this->get_content()); + } }