-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Add route caching integration tests (#37695)
* Add route caching integration tests * Apply fixes from StyleCI (#37694)
- Loading branch information
1 parent
93db226
commit 6a3254a
Showing
4 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::redirect('/foo/1', '/foo/1/bar'); | ||
|
||
Route::get('/foo/1/bar', function () { | ||
return 'Redirect response'; | ||
}); | ||
|
||
Route::get('/foo/1', function () { | ||
return 'GET response'; | ||
}); |
11 changes: 11 additions & 0 deletions
11
tests/Integration/Routing/Fixtures/wildcard_catch_all_routes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::get('/foo', function () { | ||
return 'Regular route'; | ||
}); | ||
|
||
Route::get('{slug}', function () { | ||
return 'Wildcard route'; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Routing; | ||
|
||
use Orchestra\Testbench\TestCase; | ||
|
||
class RouteCachingTest extends TestCase | ||
{ | ||
public function testWildcardCatchAllRoutes() | ||
{ | ||
$this->routes(__DIR__.'/Fixtures/wildcard_catch_all_routes.php'); | ||
|
||
$this->get('/foo')->assertSee('Regular route'); | ||
$this->get('/bar')->assertSee('Wildcard route'); | ||
} | ||
|
||
public function testRedirectRoutes() | ||
{ | ||
$this->routes(__DIR__.'/Fixtures/redirect_routes.php'); | ||
|
||
$this->post('/foo/1')->assertRedirect('/foo/1/bar'); | ||
$this->get('/foo/1/bar')->assertSee('Redirect response'); | ||
$this->get('/foo/1')->assertRedirect('/foo/1/bar'); | ||
} | ||
|
||
protected function routes(string $file) | ||
{ | ||
$this->defineCacheRoutes(file_get_contents($file)); | ||
} | ||
} |