7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @subpackage UnitTests
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
26 require_once 'Zend/Cache.php';
27 require_once 'Zend/Cache/Frontend/Output.php';
28 require_once 'Zend/Cache/Backend/Test.php';
33 require_once 'PHPUnit/Framework/TestCase.php';
38 * @subpackage UnitTests
39 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Cache_OutputFrontendTest
extends PHPUnit_Framework_TestCase
{
47 public function setUp()
49 if (!$this->_instance
) {
50 $this->_instance
= new Zend_Cache_Frontend_Output(array());
51 $this->_backend
= new Zend_Cache_Backend_Test();
52 $this->_instance
->setBackend($this->_backend
);
56 public function tearDown()
58 unset($this->_instance
);
61 public function testConstructorCorrectCall()
63 $test = new Zend_Cache_Frontend_Output(array('lifetime' => 3600, 'caching' => true));
66 public function testStartEndCorrectCall1()
69 ob_implicit_flush(false);
70 if (!($this->_instance
->start('123'))) {
72 $this->_instance
->end();
74 $data = ob_get_contents();
76 ob_implicit_flush(true);
77 $this->assertEquals('foo', $data);
80 public function testStartEndCorrectCall2()
83 ob_implicit_flush(false);
84 if (!($this->_instance
->start('false'))) {
86 $this->_instance
->end();
88 $data = ob_get_contents();
90 ob_implicit_flush(true);
91 $this->assertEquals('foobar', $data);