aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/cache_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
commite34b8ed094affdaedbf457406c98b29c125e5d8b (patch)
tree7cc51ba4ead71cb48a76747770edf622f8fe85f9 /tests/cache/cache_test.php
parent70a409d4b5411bf9e50a70d1cf3855b686304bbe (diff)
parentd11829567603e6ac37170b919efc4659b2be20cb (diff)
downloadforums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.gz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.bz2
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.xz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission-rebase
* 'develop' of https://github.com/phpbb/phpbb3: (544 commits) [feature/events] Fix improperly named event in documentation [feature/events] Fix alphabetization of events [feature/events] Put events in alphabetical order [feature/events] Make EVENTS.md lowercase [ticket/11285] Use more granularity in dependency checks in compress test [ticket/10880] The m_approve permisson no longer implies f_noapprove. [ticket/10803] Show failure message until user dismisses it [ticket/10954] Add missing semi-colon [ticket/10954] Make sure to mark subforums unread and add small fixes [feature/events] Use ` to escape HTML tags in markdown [feature/events] Remove HTML tags from markdown so they don't get parsed [ticket/10954] Miscellaneous coding fixes [feature/events] Remove extraneous space [feature/events] Add markdown template event documentation file [feature/events] forumlist_body_last_post_title_after -> _prepend (subsilver2) [feature/events] Fix overall_footer_end -> overall_footer_after (subsilver2) [feature/events] Fix typo in event name [ticket/10763] Use self when calling get_extension() in filespec class [feature/events] Fix more subsilver2 events [feature/events] Fix some subsilver2 events ... Conflicts: phpBB/install/database_update.php phpBB/posting.php
Diffstat (limited to 'tests/cache/cache_test.php')
-rw-r--r--tests/cache/cache_test.php109
1 files changed, 0 insertions, 109 deletions
diff --git a/tests/cache/cache_test.php b/tests/cache/cache_test.php
deleted file mode 100644
index c5f5fac88c..0000000000
--- a/tests/cache/cache_test.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2010 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-
-class phpbb_cache_test extends phpbb_database_test_case
-{
- private $cache_dir;
-
- public function __construct()
- {
- $this->cache_dir = dirname(__FILE__) . '/../tmp/cache/';
- }
-
- public function getDataSet()
- {
- return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
- }
-
- protected function setUp()
- {
- parent::setUp();
-
- if (file_exists($this->cache_dir))
- {
- // cache directory possibly left after aborted
- // or failed run earlier
- $this->remove_cache_dir();
- }
- $this->create_cache_dir();
- }
-
- protected function tearDown()
- {
- if (file_exists($this->cache_dir))
- {
- $this->remove_cache_dir();
- }
-
- parent::tearDown();
- }
-
- private function create_cache_dir()
- {
- $this->get_test_case_helpers()->makedirs($this->cache_dir);
- }
-
- private function remove_cache_dir()
- {
- $iterator = new DirectoryIterator($this->cache_dir);
- foreach ($iterator as $file)
- {
- if ($file != '.' && $file != '..')
- {
- unlink($this->cache_dir . '/' . $file);
- }
- }
- rmdir($this->cache_dir);
- }
-
- public function test_cache_driver_file()
- {
- $driver = new phpbb_cache_driver_file($this->cache_dir);
- $driver->put('test_key', 'test_value');
- $driver->save();
-
- $this->assertEquals(
- 'test_value',
- $driver->get('test_key'),
- 'File ACM put and get'
- );
- }
-
- public function test_cache_sql()
- {
- $driver = new phpbb_cache_driver_file($this->cache_dir);
-
- 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);
-
- $this->assertFileExists($this->cache_dir . 'sql_' . md5(preg_replace('/[\n\r\s\t]+/', ' ', $sql)) . '.php');
-
- $sql = "SELECT * FROM phpbb_config
- WHERE config_name = 'foo'";
- $result = $db->sql_query($sql, 300);
-
- $this->assertEquals($first_result, $db->sql_fetchrow($result));
-
- $sql = "SELECT * FROM phpbb_config
- WHERE config_name = 'bar'";
- $result = $db->sql_query($sql, 300);
-
- $this->assertNotEquals($first_result, $db->sql_fetchrow($result));
-
- $db->sql_close();
- }
-}