HelperFlashMessengerController.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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-2015 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 'Zend/Controller/Action.php';
  23. /**
  24. * Mock file for testbed
  25. *
  26. * @category Zend
  27. * @package Zend_Controller
  28. * @subpackage UnitTests
  29. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class HelperFlashMessengerController extends Zend_Controller_Action
  33. {
  34. /**
  35. * Test Function for indexAction
  36. *
  37. * @return void
  38. */
  39. public function indexAction()
  40. {
  41. $flashmessenger = $this->_helper->FlashMessenger;
  42. $this->getResponse()->appendBody(get_class($flashmessenger));
  43. $messages = $flashmessenger->getCurrentMessages();
  44. if (count($messages) === 0) {
  45. $this->getResponse()->appendBody('1');
  46. }
  47. $flashmessenger->addMessage('My message');
  48. $messages = $flashmessenger->getCurrentMessages();
  49. if (implode('', $messages) === 'My message') {
  50. $this->getResponse()->appendBody('2');
  51. }
  52. if ($flashmessenger->count() === 0) {
  53. $this->getResponse()->appendBody('3');
  54. }
  55. if ($flashmessenger->hasMessages() === false) {
  56. $this->getResponse()->appendBody('4');
  57. }
  58. if ($flashmessenger->getRequest() === $this->getRequest()) {
  59. $this->getResponse()->appendBody('5');
  60. }
  61. if ($flashmessenger->getResponse() === $this->getResponse()) {
  62. $this->getResponse()->appendBody('6');
  63. }
  64. }
  65. }