示例#1
0
 public function test_it_call_call_a_callable()
 {
     $callback = function () {
     };
     $parameters = ['foo' => 'bar'];
     $defaultMethod = null;
     $this->wrappedMock->shouldReceive('call')->with($callback, $parameters, $defaultMethod)->once()->andReturn('resolved');
     $this->assertEquals('resolved', $this->container->call($callback, $parameters, $defaultMethod));
 }
示例#2
0
 /**
  * Dispatch the request
  *
  * @param Route $route
  *
  * @throws NotFoundHttpException
  * @return mixed
  */
 public function dispatch(Route $route)
 {
     $action = $route->action();
     list($class, $method) = explode('@', $action['uses']);
     if (!method_exists($instance = $this->container->make($class), $method)) {
         throw new NotFoundHttpException();
     }
     $parameters = $this->resolver->resolve(new ReflectionMethod($instance, $method), $route->parameters());
     return $this->container->call([$instance, $method], $parameters);
 }