public function setUp(Phalcon\DiInterface $di = NULL, Phalcon\Config $config = NULL) { // テスト中に必要になる追加のサービスを読み込み $config = (include APP_PATH . "/app/config/config.php"); include APP_PATH . "/app/config/services.php"; // ここで必要なDIコンポーネントを取得する。config があるなら、それを parent に渡すことを忘れずに parent::setUp($di, $config); $this->_loaded = true; }
protected function setUp() { parent::setUp(); $this->di->setShared('router', function () { $router = new \Phalcon\Mvc\Router(); return $router; }); $applicationClass = $this->getApplicationClass(); if (get_class($this->application) !== $applicationClass) { $this->application = new $applicationClass($this->di); } }