Phalcon\Test\FunctionalTestCase::setUp PHP Method

setUp() protected method

This method is called before a test is executed.
protected setUp ( )
    protected function setUp()
    {
        parent::setUp();
        // Set the dispatcher
        $this->di->setShared('dispatcher', function () {
            $dispatcher = new PhDispatcher();
            $dispatcher->setControllerName('test');
            $dispatcher->setActionName('empty');
            $dispatcher->setParams([]);
            return $dispatcher;
        });
        $this->di->set('escaper', function () {
            return new PhEscaper();
        });
        if ($this->di instanceof DiInterface) {
            $this->application = new PhApplication($this->di);
        }
    }

Usage Example

Beispiel #1
0
 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;
 }
All Usage Examples Of Phalcon\Test\FunctionalTestCase::setUp