aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/cache_test.php
blob: 463095f1298255d996d2487ab6fdddd7cad72660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
*
* @package testing
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_cache_test extends phpbb_test_case
{
	protected function tearDown()
	{
		$iterator = new DirectoryIterator(__DIR__ . '/tmp');
		foreach ($iterator as $file)
		{
			if (is_file(__DIR__ . '/tmp/' . $file) && $file != '.gitkeep')
			{
				unlink(__DIR__ . '/tmp/' . $file);
			}
		}
	}

	public function test_cache_driver_file()
	{
		global $phpEx;
		$phpEx = 'txt'; // do not store files as .php

		$driver = new phpbb_cache_driver_file(__DIR__ . '/tmp/');
		$driver->put('test_key', 'test_value');
		$driver->save();

		$this->assertEquals(
			'test_value',
			$driver->get('test_key'),
			'File ACM put and get'
		);
	}
}