This commit is contained in:
Pig Fang 2020-02-01 10:12:31 +08:00
parent 2bd1a8c073
commit 25a31302ae
2 changed files with 15 additions and 9 deletions

View File

@ -0,0 +1,14 @@
<?php
namespace Tests\Concerns;
class FakeMiddleware
{
public function handle($request, $next)
{
$response = $next($request);
$response->header('X-Middleware-Test', 'value');
return $response;
}
}

View File

@ -100,15 +100,7 @@ class HookTest extends TestCase
public function testPushMiddleware()
{
Hook::pushMiddleware(get_class(new class() {
public function handle($request, $next)
{
$response = $next($request);
$response->header('X-Middleware-Test', 'value');
return $response;
}
}));
Hook::pushMiddleware(Concerns\FakeMiddleware::class);
$this->get('/')->assertHeader('X-Middleware-Test');
}
}