HelperBrokerController.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_Controller
  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
  20. * @version $Id$
  21. */
  22. require_once 'PHPUnit/Util/Filter.php';
  23. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  24. require_once 'Zend/Controller/Action.php';
  25. /**
  26. * Mock file for testbed
  27. *
  28. * @category Zend
  29. * @package Zend_Controller
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class HelperBrokerController extends Zend_Controller_Action
  35. {
  36. /**
  37. * Test Function for testGetRedirectorAction
  38. *
  39. * @return void
  40. */
  41. public function testGetRedirectorAction()
  42. {
  43. $redirector = $this->_helper->getHelper('Redirector');
  44. $this->getResponse()->appendBody(get_class($redirector));
  45. }
  46. /**
  47. * Test Function for testHelperViaMagicGetAction
  48. *
  49. * @return void
  50. */
  51. public function testHelperViaMagicGetAction()
  52. {
  53. $redirector = $this->_helper->Redirector;
  54. $this->getResponse()->appendBody(get_class($redirector));
  55. }
  56. /**
  57. * Test Function for testHelperViaMagicCallAction
  58. *
  59. * @return void
  60. */
  61. public function testHelperViaMagicCallAction()
  62. {
  63. $this->getResponse()->appendBody($this->_helper->TestHelper());
  64. }
  65. /**
  66. * Test Function for testBadHelperAction
  67. *
  68. * @return void
  69. */
  70. public function testBadHelperAction()
  71. {
  72. try {
  73. $this->_helper->getHelper('NonExistentHelper');
  74. } catch (Exception $e) {
  75. $this->getResponse()->appendBody($e->getMessage());
  76. }
  77. }
  78. /**
  79. * Test Function for testCustomHelperAction
  80. *
  81. * @return void
  82. */
  83. public function testCustomHelperAction()
  84. {
  85. $this->getResponse()->appendBody(get_class($this->_helper->TestHelper));
  86. }
  87. }