protected function setUp() { $this->_frontController = System_Application::getInstance()->getBootstrap()->getResource('FrontController'); $this->frontController->setParam('bootstrap', System_Application::getInstance()->getBootstrap()); $this->getRequest()->setBaseUrl($this->frontController->getBaseUrl()); Zend_Session::$_unitTestEnabled = true; }
/** * Get Application instance * @return System_Application */ public function getApplication() { if (!$this->_application) { $this->setApplication(System_Application::getInstance()); } return $this->_application; }
/** * Get Application instance * @return System_Application */ public function getApplication() { if (!$this->_application) { try { $this->_application = System_Application::getInstance(); } catch (Zend_Exception $e) { $root = $this->getProject()->getProperty('path.root'); $environment = $this->getProject()->getProperty('environment'); $this->_application = new System_Application($environment, $root); } } return $this->_application; }
/** * Set config dir * @param $dir */ public static function setConfigDir($dir) { self::$configDir = $dir; }
/** * @covers System_Application::__construct * @covers System_Application::<protected> */ public function testConstructorWithDir() { System_Application::setConfigDir('/data'); $app = new System_Application('test', dirname(__FILE__)); }
<?php require_once '../common.php'; $application = System_Application::getInstance(); $application->bootstrap()->run();
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->object = new System_Controller_Action_Helper_Auth(); $this->setBootstrap(System_Application::getInstance()->getBootstrap()); }
<?php require_once 'common.php'; $path = System_Application::getInstance()->getOption('path'); $modelDir = $path['application'] . '/models'; if (!isset($_SERVER['argv'][1])) { echo 'Add table and row class scrip Usege: add-table %TableName%'; die("\n"); } $tableName = $_SERVER['argv'][1]; $tableSource = "<?php\n/**\n * {$tableName} table\n */\nclass Model_Table_{$tableName} extends System_Db_Table_Abstract\n{\n\tprotected \$_name = '{$tableName}';\n\tprotected \$_rowClass = 'Model_Row_{$tableName}';\n}\n"; $rowSource = "<?php\n/**\n * {$tableName} row\n */\nclass Model_Row_{$tableName} extends System_Db_Table_Row_Abstract\n{\n}\n"; file_put_contents($modelDir . '/Table/' . $tableName . '.php', $tableSource); file_put_contents($modelDir . '/Row/' . $tableName . '.php', $rowSource);
<?php $rootPath = dirname(__FILE__); set_include_path(implode(PATH_SEPARATOR, array('../', './', get_include_path()))); putenv('APPLICATION_ENV=testing'); $environment = 'testing'; require_once 'System/Application.php'; $application = new System_Application($environment, $rootPath); $application->bootstrap(); // TODO: find a proper way to tell PHPUnit to ignore these classes Zend_Loader::loadClass('System_Test_TestCase'); Zend_Loader::loadClass('System_Test_DatabaseTestCase'); Zend_Loader::loadClass('System_Test_AjaxTestCase');