Advertisement
Guest User

PHPUnit Zend Framework

a guest
Oct 15th, 2010
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2. require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';
  3. abstract class ControllerTestCase
  4.     extends Zend_Test_PHPUnit_ControllerTestCase
  5. {
  6.     /**
  7.      * @var Zend_Application
  8.      */
  9.     protected $application;
  10.  
  11.     public function setUp()
  12.     {
  13.         $this->_setAppEnv();
  14.         $this->bootstrap = array($this, 'appBootstrap');
  15.         parent::setUp();
  16.     }
  17.  
  18.     protected function _setAppEnv()
  19.     {
  20.         //put this here so you can override
  21.         defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
  22.     }
  23.  
  24.     public function appBootstrap()
  25.     {
  26.         $this->application = new Zend_Application(APPLICATION_ENV,
  27.                                               APPLICATION_PATH . '/configs/application.ini');
  28.         $this->application->bootstrap();
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement