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