RouteCachingTest.php 807 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Illuminate\Tests\Integration\Routing;
  3. use Orchestra\Testbench\TestCase;
  4. class RouteCachingTest extends TestCase
  5. {
  6. public function testWildcardCatchAllRoutes()
  7. {
  8. $this->routes(__DIR__.'/Fixtures/wildcard_catch_all_routes.php');
  9. $this->get('/foo')->assertSee('Regular route');
  10. $this->get('/bar')->assertSee('Wildcard route');
  11. }
  12. public function testRedirectRoutes()
  13. {
  14. $this->routes(__DIR__.'/Fixtures/redirect_routes.php');
  15. $this->post('/foo/1')->assertRedirect('/foo/1/bar');
  16. $this->get('/foo/1/bar')->assertSee('Redirect response');
  17. $this->get('/foo/1')->assertRedirect('/foo/1/bar');
  18. }
  19. protected function routes(string $file)
  20. {
  21. $this->defineCacheRoutes(file_get_contents($file));
  22. }
  23. }