/** * @test */ public function guest_cant_access() { $this->guard->shouldReceive('guest')->andReturn(true); $this->request->shouldReceive('ajax')->andReturn(false); $this->redirect->shouldReceive('guest')->with('auth/login'); $next = function ($request) { return true; }; $tester = new AdminAuth($this->guard, $this->config, $this->response, $this->redirect); $result = $tester->handle($this->request, $next); $this->assertNotTrue($result); }