cacert-testmgr/external/ZendFramework-1.9.5/tests/Zend/Cache/OutputFrontendTest.php
Markus Warg 8398c9048d initially import ZendFramework-1.9.5 into repository
code was modified slightly, so the code differs from the original downloadable 1.9.5 version
2010-03-31 10:12:32 +02:00

94 lines
2.6 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: OutputFrontendTest.php 17363 2009-08-03 07:40:18Z bkarwin $
*/
/**
* Zend_Cache
*/
require_once 'Zend/Cache.php';
require_once 'Zend/Cache/Frontend/Output.php';
require_once 'Zend/Cache/Backend/Test.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_OutputFrontendTest extends PHPUnit_Framework_TestCase {
private $_instance;
public function setUp()
{
if (!$this->_instance) {
$this->_instance = new Zend_Cache_Frontend_Output(array());
$this->_backend = new Zend_Cache_Backend_Test();
$this->_instance->setBackend($this->_backend);
}
}
public function tearDown()
{
unset($this->_instance);
}
public function testConstructorCorrectCall()
{
$test = new Zend_Cache_Frontend_Output(array('lifetime' => 3600, 'caching' => true));
}
public function testStartEndCorrectCall1()
{
ob_start();
ob_implicit_flush(false);
if (!($this->_instance->start('123'))) {
echo('foobar');
$this->_instance->end();
}
$data = ob_get_contents();
ob_end_clean();
ob_implicit_flush(true);
$this->assertEquals('foo', $data);
}
public function testStartEndCorrectCall2()
{
ob_start();
ob_implicit_flush(false);
if (!($this->_instance->start('false'))) {
echo('foobar');
$this->_instance->end();
}
$data = ob_get_contents();
ob_end_clean();
ob_implicit_flush(true);
$this->assertEquals('foobar', $data);
}
}