From cd17625e213d4846f3a40395d028747ffcf113b5 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 6 Jan 2025 20:54:34 +0700 Subject: [PATCH] [ticket/17135] Add ACP modules common test PHPBB-17135 --- phpBB/phpbb/template/twig/extension.php | 1 - tests/functional/acp_test.php | 60 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tests/functional/acp_test.php diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 96a1aa91f1..982601e41b 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -15,7 +15,6 @@ namespace phpbb\template\twig; use Twig\Error\RuntimeError; use Twig\Extension\CoreExtension; -use Twig\Extension\EscaperExtension; use Twig\Runtime\EscaperRuntime; class extension extends \Twig\Extension\AbstractExtension diff --git a/tests/functional/acp_test.php b/tests/functional/acp_test.php new file mode 100644 index 0000000000..1dcd013fae --- /dev/null +++ b/tests/functional/acp_test.php @@ -0,0 +1,60 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_acp_test extends phpbb_functional_test_case +{ + public function test_all_acp_module_links() + { + $this->login(); + $this->admin_login(); + $this->add_lang(['common']); + + // Browse ACP main page + $crawler = self::request('GET', 'index.php'); + $crawler = self::$client->click($crawler->selectLink($this->lang('ACP_SHORT'))->link()); + + // Get all ACP module URLs array + $acp_modules = $crawler->filter('li.tab a')->each( + function ($node, $i) + { + // Filter out responsive mode links + if (empty($node->attr('class'))) + { + return $node->link(); + } + } + ); + + // Browse all ACP modules and get their mode URLs array + $acp_submodules = []; + foreach ($acp_modules as $module) + { + $crawler = self::$client->click($module); + $acp_submodules = array_merge($acp_submodules, $crawler->filter('div.menu_block li a')->each( + function ($node, $i) + { + return $node->link(); + } + )); + } + + // Browse all ACP submodules' modes + foreach ($acp_submodules as $acp_submodule) + { + self::$client->click($acp_submodule); + } + } +}