Don't like ads? PRO users don't see any ads ;-)
Guest

PHPUnit Zend Framework

By: a guest on Oct 15th, 2010  |  syntax: PHP  |  size: 0.75 KB  |  hits: 91  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }