Phalcon\Test\UnitTestCase::setUp PHP Method

setUp() protected method

This method is called before a test is executed.
protected setUp ( )
    protected function setUp()
    {
        $this->checkExtension('phalcon');
        // Reset the DI container
        Di::reset();
        // Instantiate a new DI container
        $di = new Di();
        // Set the URL
        $di->set('url', function () {
            $url = new Url();
            $url->setBaseUri('/');
            return $url;
        });
        $di->set('escaper', function () {
            return new Escaper();
        });
        $this->di = $di;
    }

Usage Example

 public function setUp()
 {
     // Load any additional services that might be required during testing
     $di = DI::getDefault();
     // get any DI components here, if you have a config, be sure to pass it to the parent
     parent::setUp($di);
     $this->_loaded = true;
 }
All Usage Examples Of Phalcon\Test\UnitTestCase::setUp