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; }
/** * @covers System_Application::getInstance */ public function testGetInstance() { $app = new System_Application('test'); self::assertType('Zend_Application', System_Application::getInstance()); }
<?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);