/**
  * Test the Controller::resolve method.
  *
  * @group laravel
  */
 public function testResolveMethodChecksTheIoCContainer()
 {
     IoC::register('controller: home', function () {
         require_once path('app') . 'controllers/home.php';
         $controller = new Home_Controller();
         $controller->foo = 'bar';
         return $controller;
     });
     $controller = Controller::resolve(DEFAULT_BUNDLE, 'home');
     $this->assertEquals('bar', $controller->foo);
 }
Example #2
0
 static function fromStd($controller)
 {
     list($bundle, $controller) = \Bundle::parse(strtok($controller, '@'));
     if ($obj = \Controller::resolve($bundle, $controller)) {
         return $obj;
     } else {
         throw new Error("Controller class of block [{$controller}] is undefined.");
     }
 }