Phalcon\Test\ModelTestCase::setUp PHP Method

setUp() protected method

This method is called before a test is executed.
protected setUp ( )
    protected function setUp()
    {
        parent::setUp();
        // Set Models manager
        $this->di->set('modelsManager', function () {
            return new PhModelManager();
        });
        // Set Models metadata
        $this->di->set('modelsMetadata', function () {
            return new PhMetadataMemory();
        });
        // Set the connection to the db (defaults to mysql)
        $this->setDb();
    }

Usage Example

 /**
  * Sets the test up by loading the DI container and other stuff
  *
  * @return Phalcon\DI
  */
 protected function setUp()
 {
     parent::setUp();
     // Set the dispatcher
     $this->di->set('dispatcher', function () {
         $dispatcher = new PhDispatcher();
         $dispatcher->setControllerName('test');
         $dispatcher->setActionName('empty');
         $dispatcher->setParams(array());
         return $dispatcher;
     });
     $this->di->set('escaper', function () {
         return new PhEscaper();
     });
 }
All Usage Examples Of Phalcon\Test\ModelTestCase::setUp