/** * @test */ public function startAuthenticationSetsTheCorrectValuesInTheResponseObject() { $mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock(); $mockResponse = $this->getMockBuilder(Response::class)->getMock(); $entryPoint = new HttpBasic(); $entryPoint->setOptions(['realm' => 'realm string']); $mockResponse->expects($this->once())->method('setStatus')->with(401); $mockResponse->expects($this->once())->method('setHeader')->with('WWW-Authenticate', 'Basic realm="realm string"'); $mockResponse->expects($this->once())->method('setContent')->with('Authorization required'); $entryPoint->startAuthentication($mockHttpRequest, $mockResponse); $this->assertEquals(['realm' => 'realm string'], $entryPoint->getOptions()); }