HtmlFlashTest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // Call Zend_View_Helper_HtmlFlashTest::main() if this source file is executed directly.
  3. if (!defined("PHPUnit_MAIN_METHOD")) {
  4. define("PHPUnit_MAIN_METHOD", "Zend_View_Helper_HtmlFlashTest::main");
  5. }
  6. require_once dirname(__FILE__) . '/../../../TestHelper.php';
  7. require_once 'Zend/View.php';
  8. require_once 'Zend/View/Helper/HtmlFlash.php';
  9. class Zend_View_Helper_HtmlFlashTest extends PHPUnit_Framework_TestCase
  10. {
  11. /**
  12. * @var Zend_View_Helper_HtmlFlash
  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_HtmlFlashTest");
  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_HtmlFlash();
  37. $this->helper->setView($this->view);
  38. }
  39. public function tearDown()
  40. {
  41. unset($this->helper);
  42. }
  43. public function testMakeHtmlFlash()
  44. {
  45. $htmlFlash = $this->helper->htmlFlash('/path/to/flash.swf');
  46. $objectStartElement = '<object data="/path/to/flash.swf" type="application/x-shockwave-flash">';
  47. $this->assertContains($objectStartElement, $htmlFlash);
  48. $this->assertContains('</object>', $htmlFlash);
  49. }
  50. }
  51. // Call Zend_View_Helper_HtmlFlashTest::main() if this source file is executed directly.
  52. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_HtmlFlashTest::main") {
  53. Zend_View_Helper_HtmlFlashTest::main();
  54. }