[TASK] Add leading backslashes to InvalidArgumentException
[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-2011 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 * @package TYPO3
34 * @subpackage tests
35 */
36 class AbstractBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
37
38 /**
39 * @var \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
40 */
41 protected $backend;
42
43 /**
44 * @return void
45 */
46 public function setUp() {
47 $className = 'ConcreteBackend_' . md5(uniqid(mt_rand(), TRUE));
48 eval('
49 class ' . $className . ' extends TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend {
50 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {}
51 public function get($entryIdentifier) {}
52 public function has($entryIdentifier) {}
53 public function remove($entryIdentifier) {}
54 public function flush() {}
55 public function flushByTag($tag) {}
56 public function findIdentifiersByTag($tag) {}
57 public function collectGarbage() {}
58 public function setSomeOption($value) {
59 $this->someOption = $value;
60 }
61 public function getSomeOption() {
62 return $this->someOption;
63 }
64 }
65 ');
66 $this->backend = new $className('Testing');
67 }
68
69 /**
70 * @test
71 */
72 public function theConstructorCallsSetterMethodsForAllSpecifiedOptions() {
73 $className = get_class($this->backend);
74 $backend = new $className('Testing', array('someOption' => 'someValue'));
75 $this->assertSame('someValue', $backend->getSomeOption());
76 }
77
78 }
79
80 ?>