public function whenIGet_From($path, $resourceClass) { $request = $this->request->withTarget(Path::fromString($path))->withMethod('get'); $stub = new TestDelivererStub($request); $router = new NoneRouter(RespondingTarget::factory($this->factory, $this->factory->getInstance($resourceClass))); $delivery = new WebDelivery($router, $stub, $stub); $stub->onDeliver(function (WebResponse $response) { if ($response instanceof ErrorResponse) { throw $response->getException(); } $this->model = $response->getBody(); }); $delivery->run(); }