aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/null_driver_test.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-06 21:49:24 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-06 21:49:24 -0500
commit26fd70d9cdffe0107635db5f3846dbe5ea6e3fae (patch)
tree641a33e35665c3b8198fd2d641a687560342ba56 /tests/cache/null_driver_test.php
parent74093d0fd383619ec8b58914ebe2edd68145e070 (diff)
parent2364d4b2172c9f54520f04001b29c517d7138b69 (diff)
downloadforums-26fd70d9cdffe0107635db5f3846dbe5ea6e3fae.tar
forums-26fd70d9cdffe0107635db5f3846dbe5ea6e3fae.tar.gz
forums-26fd70d9cdffe0107635db5f3846dbe5ea6e3fae.tar.bz2
forums-26fd70d9cdffe0107635db5f3846dbe5ea6e3fae.tar.xz
forums-26fd70d9cdffe0107635db5f3846dbe5ea6e3fae.zip
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (196 commits) [ticket/11219] Coding guidelines and naming consistency changes [ticket/10841] Revert more whitespace changes. [ticket/10841] Revert whitespace changes. [ticket/10841] adding space after if [ticket/10841] removing unnecessary spacing [ticket/10841] changing affectedrows check to COUNT in sql [ticket/10841] Modifying style and language selectors in UCP [ticket/11247] Fix wrong property reference in flock class. [ticket/10602] Avoid a race condition. [ticket/10602] Use last_queue_run for its intended purpose. [ticket/10716] Collect standard error from executed php process. [ticket/10716] Skip test if php is not in PATH. [ticket/10716] Exclude our dependencies from linting. [ticket/10103] New and improved wording. [ticket/10716] Only lint on php 5.3+. [ticket/10103] Assert with messages. [ticket/10103] assertLessThan/assertGreaterThan. [ticket/10103] Inline assignment is bad? [ticket/10103] $rv had too few characters. [ticket/10103] Correct flock class documentation. ... Conflicts: phpBB/includes/functions.php tests/cache/cache_test.php
Diffstat (limited to 'tests/cache/null_driver_test.php')
-rw-r--r--tests/cache/null_driver_test.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php
new file mode 100644
index 0000000000..86553d4dc5
--- /dev/null
+++ b/tests/cache/null_driver_test.php
@@ -0,0 +1,74 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+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_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_purge()
+ {
+ // does nothing
+ $this->driver->purge();
+ }
+
+ public function test_destroy()
+ {
+ // does nothing
+ $this->driver->destroy('foo');
+ }
+
+ public function test_cache_sql()
+ {
+ global $db, $cache;
+ $db = $this->new_dbal();
+ $cache = new phpbb_cache_service($this->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();
+ }
+}