request->shouldReceive('user')->withNoArgs()->once()->andReturn(true); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } /** * Test that a logged out user results in an exception. */ public function testLoggedOutUser() { $this->expectException(AuthenticationException::class); $this->request->shouldReceive('user')->withNoArgs()->once()->andReturnNull(); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } /** * Return an instance of the middleware using mocked dependencies. * * @return \Pterodactyl\Http\Middleware\Authenticate */ private function getMiddleware(): Authenticate { return new Authenticate(); } }