Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_cache_redis_driver_test | |
0.00% |
0 / 18 |
|
0.00% |
0 / 3 |
72 | |
0.00% |
0 / 1 |
| getDataSet | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setUpBeforeClass | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
42 | |||
| setUp | |
0.00% |
0 / 8 |
|
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 | require_once __DIR__ . '/common_test_case.php'; |
| 15 | |
| 16 | class phpbb_cache_redis_driver_test extends \phpbb_cache_common_test_case |
| 17 | { |
| 18 | protected static $config; |
| 19 | |
| 20 | public function getDataSet() |
| 21 | { |
| 22 | return $this->createXMLDataSet(__DIR__ . '/fixtures/config.xml'); |
| 23 | } |
| 24 | |
| 25 | static public function setUpBeforeClass(): void |
| 26 | { |
| 27 | if (!extension_loaded('redis')) |
| 28 | { |
| 29 | self::markTestSkipped('redis extension is not loaded'); |
| 30 | } |
| 31 | |
| 32 | $config = phpbb_test_case_helpers::get_test_config(); |
| 33 | if (isset($config['redis_host']) || isset($config['redis_port'])) |
| 34 | { |
| 35 | $host = isset($config['redis_host']) ? $config['redis_host'] : '0.0.0.0'; |
| 36 | $port = isset($config['redis_port']) ? $config['redis_port'] : 6379; |
| 37 | self::$config = array('host' => $host, 'port' => $port); |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | self::markTestSkipped('Test redis host/port is not specified'); |
| 42 | } |
| 43 | |
| 44 | parent::setUpBeforeClass(); |
| 45 | } |
| 46 | |
| 47 | protected function setUp(): void |
| 48 | { |
| 49 | global $phpbb_root_path, $phpbb_container, $dbname, $table_prefix; |
| 50 | |
| 51 | parent::setUp(); |
| 52 | |
| 53 | $phpbb_container = new phpbb_mock_container_builder(); |
| 54 | $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/'); |
| 55 | $config = phpbb_test_case_helpers::get_test_config(); |
| 56 | $dbname = $config['dbname']; |
| 57 | $this->driver = new \phpbb\cache\driver\redis(self::$config['host'], self::$config['port']); |
| 58 | $this->driver->purge(); |
| 59 | } |
| 60 | } |