From b3cc20a575da12e7b66f3883dcc7f0eb6ca82ad8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 4 May 2015 10:09:37 +0200 Subject: [ticket/13782] Rename null driver to dummy for PHP7 compatibility PHPBB3-13782 --- tests/cache/null_driver_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/cache') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index b9f96732f5..d5af57b009 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -24,7 +24,7 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case { parent::setUp(); - $this->driver = new \phpbb\cache\driver\null; + $this->driver = new \phpbb\cache\driver\dummy; } public function test_get_put() -- cgit v1.2.1 From 292d0ab382563143082bd8809ec189d646a31e0e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 4 May 2015 10:12:41 +0200 Subject: [ticket/13782] Rename null driver test to dummy driver test PHPBB3-13782 --- tests/cache/dummy_driver_test.php | 77 +++++++++++++++++++++++++++++++++++++++ tests/cache/null_driver_test.php | 77 --------------------------------------- 2 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 tests/cache/dummy_driver_test.php delete mode 100644 tests/cache/null_driver_test.php (limited to 'tests/cache') diff --git a/tests/cache/dummy_driver_test.php b/tests/cache/dummy_driver_test.php new file mode 100644 index 0000000000..6cb6b73729 --- /dev/null +++ b/tests/cache/dummy_driver_test.php @@ -0,0 +1,77 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_cache_dummy_driver_test extends phpbb_database_test_case +{ + protected $driver; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + protected function setUp() + { + parent::setUp(); + + $this->driver = new \phpbb\cache\driver\dummy; + } + + public function test_get_put() + { + $this->assertSame(false, $this->driver->get('key')); + + $this->driver->put('key', 'value'); + + // null driver does not cache + $this->assertSame(false, $this->driver->get('key')); + } + + public function test_purge() + { + $this->assertNull($this->driver->purge()); + } + + public function test_destroy() + { + $this->assertNull($this->driver->destroy('foo')); + } + + public function test_cache_sql() + { + global $db, $cache, $phpbb_root_path, $phpEx; + $config = new phpbb\config\config(array()); + $db = $this->new_dbal(); + $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); + + $sql = "SELECT * FROM phpbb_config + WHERE config_name = 'foo'"; + $result = $db->sql_query($sql, 300); + $first_result = $db->sql_fetchrow($result); + $expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0); + $this->assertEquals($expected, $first_result); + + $sql = 'DELETE FROM phpbb_config'; + $result = $db->sql_query($sql); + + // As null cache driver does not actually cache, + // this should return no results + $sql = "SELECT * FROM phpbb_config + WHERE config_name = 'foo'"; + $result = $db->sql_query($sql, 300); + + $this->assertSame(false, $db->sql_fetchrow($result)); + + $db->sql_close(); + } +} diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php deleted file mode 100644 index d5af57b009..0000000000 --- a/tests/cache/null_driver_test.php +++ /dev/null @@ -1,77 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -class phpbb_cache_null_driver_test extends phpbb_database_test_case -{ - protected $driver; - - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); - } - - protected function setUp() - { - parent::setUp(); - - $this->driver = new \phpbb\cache\driver\dummy; - } - - public function test_get_put() - { - $this->assertSame(false, $this->driver->get('key')); - - $this->driver->put('key', 'value'); - - // null driver does not cache - $this->assertSame(false, $this->driver->get('key')); - } - - public function test_purge() - { - $this->assertNull($this->driver->purge()); - } - - public function test_destroy() - { - $this->assertNull($this->driver->destroy('foo')); - } - - public function test_cache_sql() - { - global $db, $cache, $phpbb_root_path, $phpEx; - $config = new phpbb\config\config(array()); - $db = $this->new_dbal(); - $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); - - $sql = "SELECT * FROM phpbb_config - WHERE config_name = 'foo'"; - $result = $db->sql_query($sql, 300); - $first_result = $db->sql_fetchrow($result); - $expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0); - $this->assertEquals($expected, $first_result); - - $sql = 'DELETE FROM phpbb_config'; - $result = $db->sql_query($sql); - - // As null cache driver does not actually cache, - // this should return no results - $sql = "SELECT * FROM phpbb_config - WHERE config_name = 'foo'"; - $result = $db->sql_query($sql, 300); - - $this->assertSame(false, $db->sql_fetchrow($result)); - - $db->sql_close(); - } -} -- cgit v1.2.1 From 16f3b8c2b9de388223cbe8ace9e1d9bcf0ba5e11 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 27 Aug 2015 10:51:10 +0200 Subject: [ticket/13904] Modify files for changes in ini wrapper PHPBB3-13904 --- tests/cache/apc_driver_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/cache') diff --git a/tests/cache/apc_driver_test.php b/tests/cache/apc_driver_test.php index 10130b465b..706f274448 100644 --- a/tests/cache/apc_driver_test.php +++ b/tests/cache/apc_driver_test.php @@ -34,14 +34,14 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case self::markTestSkipped('APC extension is not loaded'); } - $php_ini = new \phpbb\php\ini; + $php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - if (!$php_ini->get_bool('apc.enabled')) + if (!$php_ini->getBool('apc.enabled')) { self::markTestSkipped('APC is not enabled. Make sure apc.enabled=1 in php.ini'); } - if (PHP_SAPI == 'cli' && !$php_ini->get_bool('apc.enable_cli')) + if (PHP_SAPI == 'cli' && !$php_ini->getBool('apc.enable_cli')) { self::markTestSkipped('APC is not enabled for CLI. Set apc.enable_cli=1 in php.ini'); } -- cgit v1.2.1