127 lines
3.9 KiB
PHP
127 lines
3.9 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Zend Framework
|
||
|
*
|
||
|
* LICENSE
|
||
|
*
|
||
|
* This source file is subject to the new BSD license that is bundled
|
||
|
* with this package in the file LICENSE.txt.
|
||
|
* It is also available through the world-wide-web at this URL:
|
||
|
* http://framework.zend.com/license/new-bsd
|
||
|
* If you did not receive a copy of the license and are unable to
|
||
|
* obtain it through the world-wide-web, please send an email
|
||
|
* to license@zend.com so we can send you a copy immediately.
|
||
|
*
|
||
|
* @category Zend
|
||
|
* @package Zend_Cache
|
||
|
* @subpackage UnitTests
|
||
|
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||
|
* @version $Id: XcacheBackendTest.php 17363 2009-08-03 07:40:18Z bkarwin $
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Zend_Cache
|
||
|
*/
|
||
|
require_once 'Zend/Cache.php';
|
||
|
require_once 'Zend/Cache/Backend/Xcache.php';
|
||
|
|
||
|
/**
|
||
|
* Common tests for backends
|
||
|
*/
|
||
|
require_once 'CommonBackendTest.php';
|
||
|
|
||
|
/**
|
||
|
* PHPUnit test case
|
||
|
*/
|
||
|
require_once 'PHPUnit/Framework/TestCase.php';
|
||
|
|
||
|
/**
|
||
|
* @category Zend
|
||
|
* @package Zend_Cache
|
||
|
* @subpackage UnitTests
|
||
|
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||
|
* @group Zend_Cache
|
||
|
*/
|
||
|
class Zend_Cache_XcacheBackendTest extends Zend_Cache_CommonBackendTest {
|
||
|
|
||
|
protected $_instance;
|
||
|
|
||
|
public function __construct($name = null, array $data = array(), $dataName = '')
|
||
|
{
|
||
|
parent::__construct('Zend_Cache_Backend_Xcache', $data, $dataName);
|
||
|
}
|
||
|
|
||
|
public function setUp($notag = true)
|
||
|
{
|
||
|
$this->_instance = new Zend_Cache_Backend_Xcache(array(
|
||
|
'user' => TESTS_ZEND_CACHE_XCACHE_USER,
|
||
|
'password' => TESTS_ZEND_CACHE_XCACHE_PASSWORD
|
||
|
));
|
||
|
parent::setUp($notag);
|
||
|
}
|
||
|
|
||
|
public function tearDown()
|
||
|
{
|
||
|
parent::tearDown();
|
||
|
unset($this->_instance);
|
||
|
}
|
||
|
|
||
|
public function testConstructorCorrectCall()
|
||
|
{
|
||
|
$test = new Zend_Cache_Backend_Xcache();
|
||
|
}
|
||
|
|
||
|
public function testCleanModeOld() {
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
$this->_instance->clean('old');
|
||
|
// do nothing, just to see if an error occured
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
public function testCleanModeMatchingTags() {
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
$this->_instance->clean('matchingTag', array('tag1'));
|
||
|
// do nothing, just to see if an error occured
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
public function testCleanModeNotMatchingTags() {
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
$this->_instance->clean('notMatchingTag', array('tag1'));
|
||
|
// do nothing, just to see if an error occured
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
// Because of limitations of this backend...
|
||
|
public function testGetWithAnExpiredCacheId() {}
|
||
|
public function testCleanModeMatchingTags2() {}
|
||
|
public function testCleanModeNotMatchingTags2() {}
|
||
|
public function testCleanModeNotMatchingTags3() {}
|
||
|
public function testSaveCorrectCall()
|
||
|
{
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
parent::testSaveCorrectCall();
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
public function testSaveWithNullLifeTime()
|
||
|
{
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
parent::testSaveWithNullLifeTime();
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
public function testSaveWithSpecificLifeTime()
|
||
|
{
|
||
|
|
||
|
$this->_instance->setDirectives(array('logging' => false));
|
||
|
parent::testSaveWithSpecificLifeTime();
|
||
|
$this->_instance->setDirectives(array('logging' => true));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|