added unit tests for the caching framework (backported from FLOW3)
[Packages/TYPO3.CMS.git] / tests / t3lib / cache / backend / t3lib_cache_backend_abstractbackendtestcase.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Ingo Renner <ingo@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25
26 /**
27 * Testcase for the abstract cache backend
28 *
29 * This file is a backport from FLOW3
30 *
31 * @author Ingo Renner <ingo@typo3.org>
32 * @package TYPO3
33 * @subpackage tests
34 * @version $Id$
35 */
36 class t3lib_cache_backend_AbstractBackendTestCase extends tx_phpunit_testcase {
37
38 /**
39 * @var t3lib_cache_backend_AbstractBackend
40 */
41 protected $backend;
42
43 /**
44 * @return void
45 * @author Robert Lemke <robert@typo3.org>
46 * @author Ingo Renner <ingo@typo3.org>
47 */
48 public function setUp() {
49 $className = uniqid('ConcreteBackend_');
50 eval('
51 class ' . $className. ' extends t3lib_cache_backend_AbstractBackend {
52 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {}
53 public function get($entryIdentifier) {}
54 public function has($entryIdentifier) {}
55 public function remove($entryIdentifier) {}
56 public function flush() {}
57 public function flushByTag($tag) {}
58 public function flushByTags(array $tags) {}
59 public function findIdentifiersByTag($tag) {}
60 public function findIdentifiersByTags(array $tags) {}
61 public function collectGarbage() {}
62 public function setSomeOption($value) {
63 $this->someOption = $value;
64 }
65 public function getSomeOption() {
66 return $this->someOption;
67 }
68 }
69 ');
70 $this->backend = new $className();
71 }
72
73 /**
74 * @test
75 * @author Robert Lemke <robert@typo3.org>
76 */
77 public function theConstructorCallsSetterMethodsForAllSpecifiedOptions() {
78 $className = get_class($this->backend);
79 $backend = new $className(array('someOption' => 'someValue'));
80 $this->assertSame('someValue', $backend->getSomeOption());
81 }
82
83 }
84
85 ?>