PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/Zend/Cache/OutputFrontendTest.php

https://bitbucket.org/dbaltas/zend-framework-1.x-on-git
PHP | 87 lines | 47 code | 9 blank | 31 comment | 3 complexity | 106d70e9dcb4025a183c14d5a1c8db19 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  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.
  14. *
  15. * @category Zend
  16. * @package Zend_Cache
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: OutputFrontendTest.php 24593 2012-01-05 20:35:02Z matthew $
  21. */
  22. /**
  23. * Zend_Cache
  24. */
  25. require_once 'Zend/Cache.php';
  26. require_once 'Zend/Cache/Frontend/Output.php';
  27. require_once 'Zend/Cache/Backend/Test.php';
  28. /**
  29. * @category Zend
  30. * @package Zend_Cache
  31. * @subpackage UnitTests
  32. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. * @group Zend_Cache
  35. */
  36. class Zend_Cache_OutputFrontendTest extends PHPUnit_Framework_TestCase {
  37. private $_instance;
  38. public function setUp()
  39. {
  40. if (!$this->_instance) {
  41. $this->_instance = new Zend_Cache_Frontend_Output(array());
  42. $this->_backend = new Zend_Cache_Backend_Test();
  43. $this->_instance->setBackend($this->_backend);
  44. }
  45. }
  46. public function tearDown()
  47. {
  48. unset($this->_instance);
  49. }
  50. public function testConstructorCorrectCall()
  51. {
  52. $test = new Zend_Cache_Frontend_Output(array('lifetime' => 3600, 'caching' => true));
  53. }
  54. public function testStartEndCorrectCall1()
  55. {
  56. ob_start();
  57. ob_implicit_flush(false);
  58. if (!($this->_instance->start('123'))) {
  59. echo('foobar');
  60. $this->_instance->end();
  61. }
  62. $data = ob_get_clean();
  63. ob_implicit_flush(true);
  64. $this->assertEquals('foo', $data);
  65. }
  66. public function testStartEndCorrectCall2()
  67. {
  68. ob_start();
  69. ob_implicit_flush(false);
  70. if (!($this->_instance->start('false'))) {
  71. echo('foobar');
  72. $this->_instance->end();
  73. }
  74. $data = ob_get_clean();
  75. ob_implicit_flush(true);
  76. $this->assertEquals('foobar', $data);
  77. }
  78. }