From 1e3dff83b3e56353fd97a6581989c478e52ed892 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 15:03:44 -0500 Subject: [ticket/9983] Split cache test into per-driver files. PHPBB3-9983 --- tests/cache/null_driver_test.php | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/cache/null_driver_test.php (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php new file mode 100644 index 0000000000..7bf72931a0 --- /dev/null +++ b/tests/cache/null_driver_test.php @@ -0,0 +1,45 @@ +createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + public function test_null_cache_sql() + { + $driver = new phpbb_cache_driver_null; + + global $db, $cache; + $db = $this->new_dbal(); + $cache = new phpbb_cache_service($driver); + + $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 829b75e5c8d7b053f3988db89f6f9505102c92b3 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 15:06:32 -0500 Subject: [ticket/9983] Create driver in setup in null driver test. PHPBB3-9983 --- tests/cache/null_driver_test.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 7bf72931a0..45e53edaa1 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -9,18 +9,25 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case { + protected $driver; + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); } - public function test_null_cache_sql() + protected function setUp() { - $driver = new phpbb_cache_driver_null; + parent::setUp(); + + $this->driver = new phpbb_cache_driver_null; + } + public function test_null_cache_sql() + { global $db, $cache; $db = $this->new_dbal(); - $cache = new phpbb_cache_service($driver); + $cache = new phpbb_cache_service($this->driver); $sql = "SELECT * FROM phpbb_config WHERE config_name = 'foo'"; -- cgit v1.2.1 From c3d1408c52dabcafa314fcc13d19f0c537d3a5df Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 18:49:27 -0500 Subject: [ticket/9983] get/put cache test moved to a base class. PHPBB3-9983 --- tests/cache/null_driver_test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 45e53edaa1..efa56762bf 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -23,6 +23,16 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case $this->driver = new phpbb_cache_driver_null; } + 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_null_cache_sql() { global $db, $cache; -- cgit v1.2.1 From 90bd7858fdf418c45bac1b30a4dc634cd23f5247 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 18:52:04 -0500 Subject: [ticket/9983] Rename test methods. PHPBB3-9983 --- tests/cache/null_driver_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index efa56762bf..a9b40c5f40 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -33,7 +33,7 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case $this->assertSame(false, $this->driver->get('key')); } - public function test_null_cache_sql() + public function test_cache_sql() { global $db, $cache; $db = $this->new_dbal(); -- cgit v1.2.1 From d9e636fab0b1c2de36e38e7bdd3498711108a0e6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 18:53:13 -0500 Subject: [ticket/9983] Add a purge test. PHPBB3-9983 --- tests/cache/null_driver_test.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index a9b40c5f40..1e8b254294 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -33,6 +33,12 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case $this->assertSame(false, $this->driver->get('key')); } + public function test_purge() + { + // does nothing + $this->driver->purge(); + } + public function test_cache_sql() { global $db, $cache; -- cgit v1.2.1 From dd36b128e80112ba47ae51dca47702209e8aac18 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 1 Dec 2012 18:59:28 -0500 Subject: [ticket/9983] Add a test for destroy. PHPBB3-9983 --- tests/cache/null_driver_test.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 1e8b254294..86553d4dc5 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -39,6 +39,12 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case $this->driver->purge(); } + public function test_destroy() + { + // does nothing + $this->driver->destroy('foo'); + } + public function test_cache_sql() { global $db, $cache; -- cgit v1.2.1 From 9c7772040c473fd453971eeb2c9ee8ed26069a2d Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 29 Dec 2012 14:23:14 -0500 Subject: [ticket/11037] Fix unit tests. PHPBB3-11037 --- tests/cache/null_driver_test.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 86553d4dc5..43a0cc806c 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -47,9 +47,10 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case public function test_cache_sql() { - global $db, $cache; + global $db, $cache, $phpbb_root_path, $phpEx; + $config = new phpbb_config(array()); $db = $this->new_dbal(); - $cache = new phpbb_cache_service($this->driver); + $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx); $sql = "SELECT * FROM phpbb_config WHERE config_name = 'foo'"; -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- tests/cache/null_driver_test.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 43a0cc806c..ce78f333dd 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -20,7 +20,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\null; } public function test_get_put() @@ -48,23 +48,23 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case public function test_cache_sql() { global $db, $cache, $phpbb_root_path, $phpEx; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); $db = $this->new_dbal(); - $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx); + $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); - $sql = "SELECT * FROM phpbb_config + $sql = "SELECT * FROM \phpbb\config\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'; + $sql = 'DELETE FROM \phpbb\config\config'; $result = $db->sql_query($sql); // As null cache driver does not actually cache, // this should return no results - $sql = "SELECT * FROM phpbb_config + $sql = "SELECT * FROM \phpbb\config\config WHERE config_name = 'foo'"; $result = $db->sql_query($sql, 300); -- cgit v1.2.1 From e10c3d8c08974f2f543e41e6b12d9eb7b0c6b984 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 15:16:35 +0200 Subject: [ticket/11700] Fix config namespace mishap in cache tests PHPBB3-11700 --- tests/cache/null_driver_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index ce78f333dd..58e57f2b3a 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -48,23 +48,23 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case public function test_cache_sql() { global $db, $cache, $phpbb_root_path, $phpEx; - $config = new \phpbb\config\config(array()); + $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\config + $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\config'; + $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\config + $sql = "SELECT * FROM phpbb_config WHERE config_name = 'foo'"; $result = $db->sql_query($sql, 300); -- cgit v1.2.1 From fe99e60d827ba34dbc4bc5cbb7dd9368164ceed3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 5 May 2014 18:21:28 +0200 Subject: [ticket/12486] Make assertion on the return to remove "Risky" from phpunit PHPBB3-12486 --- tests/cache/null_driver_test.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 58e57f2b3a..049d0412b6 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -35,14 +35,12 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case public function test_purge() { - // does nothing - $this->driver->purge(); + $this->assertNull($this->driver->purge()); } public function test_destroy() { - // does nothing - $this->driver->destroy('foo'); + $this->assertNull($this->driver->destroy('foo')); } public function test_cache_sql() -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- tests/cache/null_driver_test.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/cache/null_driver_test.php') diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php index 049d0412b6..b9f96732f5 100644 --- a/tests/cache/null_driver_test.php +++ b/tests/cache/null_driver_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1