Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_metadata_manager_test | |
0.00% |
0 / 23 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
| setUpBeforeClass | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| tearDownAfterClass | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| setUp | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| test_extensions_list | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| test_extensions_details | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| test_extensions_details_notexists | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 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 | */ |
| 17 | class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | private static $helper; |
| 20 | |
| 21 | protected static $fixtures = array( |
| 22 | './', |
| 23 | ); |
| 24 | |
| 25 | public static function setUpBeforeClass(): void |
| 26 | { |
| 27 | parent::setUpBeforeClass(); |
| 28 | |
| 29 | self::$helper = new phpbb_test_case_helpers(__CLASS__); |
| 30 | self::$helper->copy_ext_fixtures(__DIR__ . '/fixtures/ext/', self::$fixtures); |
| 31 | |
| 32 | self::install_ext('foo/bar'); |
| 33 | } |
| 34 | |
| 35 | public static function tearDownAfterClass(): void |
| 36 | { |
| 37 | parent::tearDownAfterClass(); |
| 38 | |
| 39 | self::uninstall_ext('foo/bar'); |
| 40 | self::$helper->restore_original_ext_dir(); |
| 41 | } |
| 42 | |
| 43 | protected function setUp(): void |
| 44 | { |
| 45 | parent::setUp(); |
| 46 | |
| 47 | $this->login(); |
| 48 | $this->admin_login(); |
| 49 | $this->add_lang('acp/extensions'); |
| 50 | } |
| 51 | |
| 52 | public function test_extensions_list() |
| 53 | { |
| 54 | $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); |
| 55 | $this->assertStringContainsString($this->lang('EXTENSIONS_EXPLAIN'), $crawler->filter('#main')->text()); |
| 56 | $this->assertStringContainsString('phpBB 3.1 Extension Testing', $crawler->filter('#main')->text()); |
| 57 | $this->assertStringContainsString('Details', $crawler->filter('#main')->text()); |
| 58 | } |
| 59 | |
| 60 | public function test_extensions_details() |
| 61 | { |
| 62 | $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo%2Fbar&sid=' . $this->sid); |
| 63 | |
| 64 | // Test whether the details are displayed |
| 65 | $this->assertStringContainsString($this->lang('CLEAN_NAME'), $crawler->filter('#main')->text()); |
| 66 | $this->assertStringContainsString('foo/bar', $crawler->filter('#meta_name')->text()); |
| 67 | |
| 68 | $this->assertStringContainsString($this->lang('PHP_VERSION'), $crawler->filter('#main')->text()); |
| 69 | $this->assertStringContainsString('>=5.3', $crawler->filter('#require_php')->text()); |
| 70 | // Details should be html escaped |
| 71 | // However, text() only returns the displayed text, so HTML Special Chars are decoded. |
| 72 | // So we test this directly on the content of the response. |
| 73 | $this->assertStringContainsString('<span id="require_php">>=5.3</span>', $this->get_content()); |
| 74 | } |
| 75 | |
| 76 | public function test_extensions_details_notexists() |
| 77 | { |
| 78 | $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=not%2Fexists&sid=' . $this->sid); |
| 79 | |
| 80 | // Error message because the files do not exist |
| 81 | $this->assertStringContainsString($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('#main')->text()); |
| 82 | } |
| 83 | } |