Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_acp_test
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 1
 test_all_acp_module_links
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14/**
15* @group functional
16*/
17class phpbb_functional_acp_test extends phpbb_functional_test_case
18{
19    public function test_all_acp_module_links()
20    {
21        $this->login();
22        $this->admin_login();
23        $this->add_lang(['common']);
24
25        // Browse ACP main page
26        $crawler = self::request('GET', 'index.php');
27        $crawler = self::$client->click($crawler->selectLink($this->lang('ACP_SHORT'))->link());
28        self::assert_response_html();
29
30        // Get all ACP module URLs array
31        $acp_modules = $crawler->filter('li.tab a')->each(
32            function ($node, $i)
33            {
34                // Filter out responsive mode links
35                if (empty($node->attr('class')))
36                {
37                    return $node->link();
38                }
39            }
40        );
41        $this->assertNotEmpty($acp_modules);
42
43        // Browse all ACP modules and get their mode URLs array
44        $acp_submodules = [];
45        foreach ($acp_modules as $module)
46        {
47            $crawler = self::$client->click($module);
48            self::assert_response_html();
49            $acp_submodules = array_merge($acp_submodules, $crawler->filter('div.menu-block li a')->each(
50                function ($node, $i)
51                {
52                    return $node->link();
53                }
54            ));
55        }
56        $this->assertNotEmpty($acp_submodules);
57
58        // Browse all ACP submodules' modes
59        foreach ($acp_submodules as $acp_submodule)
60        {
61            // Don't click the ACP Extensions Catalog to prevent calling an external HTTP service in the test suite
62            if ($acp_submodule->getNode()->textContent === $this->lang('ACP_EXTENSIONS_CATALOG'))
63            {
64                continue;
65            }
66
67            self::$client->click($acp_submodule);
68            self::assert_response_html();
69        }
70    }
71}