TYPO3 API  SVNRelease
t3lib_cache_backend_abstractbackendTest.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009-2011 Ingo Renner <ingo@typo3.org>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00024 
00025 
00026 /**
00027  * Testcase for the abstract cache backend
00028  *
00029  * This file is a backport from FLOW3
00030  *
00031  * @author  Ingo Renner <ingo@typo3.org>
00032  * @package TYPO3
00033  * @subpackage tests
00034  * @version $Id: t3lib_cache_backend_abstractbackendTest.php 10121 2011-01-18 20:15:30Z ohader $
00035  */
00036 class t3lib_cache_backend_AbstractBackendTest extends tx_phpunit_testcase {
00037 
00038     /**
00039      * @var t3lib_cache_backend_AbstractBackend
00040      */
00041     protected $backend;
00042 
00043     /**
00044      * @return void
00045      * @author Robert Lemke <robert@typo3.org>
00046      * @author Ingo Renner <ingo@typo3.org>
00047      */
00048     public function setUp() {
00049         $className = uniqid('ConcreteBackend_');
00050         eval('
00051             class ' . $className. ' extends t3lib_cache_backend_AbstractBackend {
00052                 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {}
00053                 public function get($entryIdentifier) {}
00054                 public function has($entryIdentifier) {}
00055                 public function remove($entryIdentifier) {}
00056                 public function flush() {}
00057                 public function flushByTag($tag) {}
00058                 public function flushByTags(array $tags) {}
00059                 public function findIdentifiersByTag($tag) {}
00060                 public function findIdentifiersByTags(array $tags) {}
00061                 public function collectGarbage() {}
00062                 public function setSomeOption($value) {
00063                     $this->someOption = $value;
00064                 }
00065                 public function getSomeOption() {
00066                     return $this->someOption;
00067                 }
00068             }
00069         ');
00070         $this->backend = new $className();
00071     }
00072 
00073     /**
00074      * @test
00075      * @author Robert Lemke <robert@typo3.org>
00076      */
00077     public function theConstructorCallsSetterMethodsForAllSpecifiedOptions() {
00078         $className = get_class($this->backend);
00079         $backend = new $className(array('someOption' => 'someValue'));
00080         $this->assertSame('someValue', $backend->getSomeOption());
00081     }
00082 }
00083 
00084 ?>