public function test_cannot_dispatch_when_method_does_not_exist() { $this->setExpectedException(NotFoundHttpException::class); $controller = new ControllerStub(); $this->container->shouldReceive('make')->with('Mosaic\\Tests\\Routing\\Dispatchers\\ControllerStub')->once()->andReturn($controller); $route = new Route(['GET'], '/', ['uses' => 'Mosaic\\Tests\\Routing\\Dispatchers\\ControllerStub@nonExisting']); $this->dispatcher->dispatch($route); }
public function test_can_resolve_method_parameters_with_typehints_and_route_parameters() { $this->container->shouldReceive('make')->with(Container::class)->once()->andReturn($this->container); $parameters = $this->resolver->resolve(new \ReflectionMethod(ControllerStubWithParams::class, 'index'), ['id' => 1]); $this->assertArrayHasKey('container', $parameters); $this->assertArrayHasKey('id', $parameters); $this->assertEquals($this->container, $parameters['container']); $this->assertEquals(1, $parameters['id']); }