/**
  * @depends testCreateServiceInjection
  * @depends testConstruct
  * 
  * @param \Groupfony\Framework\ServiceInjection $serviceInjection
  * @param \Groupfony\Framework\Tests\Controller $controller
  */
 public function testCallMethod(ServiceInjection $serviceInjection, \Groupfony\Framework\Tests\Controller $controller)
 {
     $result = $serviceInjection->callMethod($controller, 'someAction', array('id' => 155));
     $this->assertEquals('foo', $result);
     #$client =
     #$client->request('GET', '/blubb/2');
 }
Пример #2
0
 /**
  * 
  * @param Request $request
  * @param string $beforeClass
  * @param string $beforeMethod
  * @return Response
  */
 public function run(Request $request, $beforeClass = null, $beforeMethod = null)
 {
     $routeParameters = $this->matchRoute($this->getRoutePath($request));
     list($controllerClassName, $action) = explode('::', $routeParameters['_controller']);
     $serviceInjection = new ServiceInjection($this->container, $request);
     if ($beforeClass && $beforeMethod) {
         $beforeResponse = $serviceInjection->run($beforeClass, $beforeMethod, $routeParameters);
         if ($beforeResponse instanceof Response || $beforeResponse === false) {
             return $beforeResponse;
         }
     }
     return $serviceInjection->run($controllerClassName, $action, $routeParameters, true);
 }