예제 #1
0
 /**
  * @test
  */
 public function buildResponseIfApplicableRetunsHttpRequestIfApplicableRedirectIsFound()
 {
     $this->mockHttpRequest->expects($this->atLeastOnce())->method('getRelativePath')->willReturn('some/relative/path');
     $mockRedirect = $this->getMockBuilder(Redirect::class)->disableOriginalConstructor()->getMock();
     $mockRedirect->expects($this->atLeastOnce())->method('getStatusCode')->willReturn(301);
     $this->mockRedirectStorage->expects($this->once())->method('getOneBySourceUriPathAndHost')->with('some/relative/path')->willReturn($mockRedirect);
     $this->inject($this->redirectService, 'redirectStorage', $this->mockRedirectStorage);
     $request = $this->redirectService->buildResponseIfApplicable($this->mockHttpRequest);
     $this->assertInstanceOf(Response::class, $request);
 }