Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
13 / 13 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_local_test_case | |
100.00% |
13 / 13 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| setUp | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| tearDown | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| assertFileContains | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | use FastImageSize\FastImageSize; |
| 15 | use phpbb\mimetype\extension_guesser; |
| 16 | use phpbb\mimetype\guesser; |
| 17 | use phpbb\storage\adapter\local; |
| 18 | |
| 19 | class phpbb_local_test_case extends phpbb_test_case |
| 20 | { |
| 21 | protected $adapter; |
| 22 | |
| 23 | protected $path; |
| 24 | |
| 25 | protected $filesystem; |
| 26 | |
| 27 | protected function setUp(): void |
| 28 | { |
| 29 | parent::setUp(); |
| 30 | |
| 31 | $this->filesystem = new \phpbb\filesystem\filesystem(); |
| 32 | $phpbb_root_path = getcwd() . DIRECTORY_SEPARATOR; |
| 33 | |
| 34 | $this->adapter = new local( |
| 35 | $this->filesystem, |
| 36 | $phpbb_root_path |
| 37 | ); |
| 38 | |
| 39 | $this->path = $phpbb_root_path . 'test_path/'; |
| 40 | mkdir($this->path); |
| 41 | } |
| 42 | |
| 43 | protected function tearDown(): void |
| 44 | { |
| 45 | parent::tearDown(); |
| 46 | |
| 47 | $this->adapter = null; |
| 48 | rmdir($this->path); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Check if a file contains a string |
| 53 | * |
| 54 | * @param string $file |
| 55 | * @param string $content |
| 56 | */ |
| 57 | protected function assertFileContains(string $file, string $content): void |
| 58 | { |
| 59 | $this->assertEquals($content, file_get_contents($file)); |
| 60 | } |
| 61 | } |