handle() public méthode

Handle an incoming request.
public handle ( Illuminate\Http\Request $request, Closure $next ) : mixed
$request Illuminate\Http\Request
$next Closure
Résultat mixed
 /** @test **/
 function it_returns_the_next_instance_given_a_logged_user()
 {
     $auth = $this->mockAuthGuestCheckWith($response = false);
     $closure = function ($request) {
         return 'closure';
     };
     $request = Mockery::mock(Illuminate\Http\Request::class);
     $middleware = new Authenticate($auth);
     $this->assertEquals('closure', $middleware->handle($request, $closure));
 }
 public function testHandle_withExistingSession()
 {
     $sr = \Mockery::mock(SR::class)->makePartial();
     $a = new A($sr);
     $closure = function ($request) {
         return 2 * $request;
     };
     $sr->shouldReceive('hasActiveSession')->andReturn(TRUE);
     \Session::shouldReceive('get')->with('logged_in')->andReturn(TRUE);
     $r = $a->handle(149, $closure);
     $this->assertSame(2 * 149, $r);
 }