HtmlPageTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // Call Zend_View_Helper_HtmlPageTest::main() if this source file is executed directly.
  3. if (!defined("PHPUnit_MAIN_METHOD")) {
  4. define("PHPUnit_MAIN_METHOD", "Zend_View_Helper_HtmlPageTest::main");
  5. }
  6. require_once dirname(__FILE__) . '/../../../TestHelper.php';
  7. require_once 'Zend/View.php';
  8. require_once 'Zend/View/Helper/HtmlPage.php';
  9. class Zend_View_Helper_HtmlPageTest extends PHPUnit_Framework_TestCase
  10. {
  11. /**
  12. * @var Zend_View_Helper_HtmlPage
  13. */
  14. public $helper;
  15. /**
  16. * Runs the test methods of this class.
  17. *
  18. * @access public
  19. * @static
  20. */
  21. public static function main()
  22. {
  23. require_once "PHPUnit/TextUI/TestRunner.php";
  24. $suite = new PHPUnit_Framework_TestSuite("Zend_View_Helper_HtmlPageTest");
  25. PHPUnit_TextUI_TestRunner::run($suite);
  26. }
  27. /**
  28. * Sets up the fixture, for example, open a network connection.
  29. * This method is called before a test is executed.
  30. *
  31. * @access protected
  32. */
  33. protected function setUp()
  34. {
  35. $this->view = new Zend_View();
  36. $this->helper = new Zend_View_Helper_HtmlPage();
  37. $this->helper->setView($this->view);
  38. }
  39. public function tearDown()
  40. {
  41. unset($this->helper);
  42. }
  43. public function testMakeHtmlPage()
  44. {
  45. $htmlPage = $this->helper->htmlPage('/path/to/page.html');
  46. $objectStartElement = '<object data="/path/to/page.html"'
  47. . ' type="text/html"'
  48. . ' classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13">';
  49. $this->assertContains($objectStartElement, $htmlPage);
  50. $this->assertContains('</object>', $htmlPage);
  51. }
  52. }
  53. // Call Zend_View_Helper_HtmlPageTest::main() if this source file is executed directly.
  54. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_HtmlPageTest::main") {
  55. Zend_View_Helper_HtmlPageTest::main();
  56. }