matchRequest() 공개 메소드

Matches a \Neos\Flow\Mvc\RequestInterface against its set URL pattern rules
public matchRequest ( Neos\Flow\Mvc\RequestInterface $request ) : boolean
$request Neos\Flow\Mvc\RequestInterface The request that should be matched
리턴 boolean TRUE if the pattern matched, FALSE otherwise
예제 #1
0
 /**
  * @test
  * @dataProvider matchRequestDataProvider
  */
 public function matchRequestTests($uriPath, $pattern, $shouldMatch)
 {
     $mockActionRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->getMock();
     $mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
     $mockActionRequest->expects($this->atLeastOnce())->method('getHttpRequest')->will($this->returnValue($mockHttpRequest));
     $mockUri = $this->getMockBuilder(Uri::class)->disableOriginalConstructor()->getMock();
     $mockHttpRequest->expects($this->atLeastOnce())->method('getUri')->will($this->returnValue($mockUri));
     $mockUri->expects($this->atLeastOnce())->method('getPath')->will($this->returnValue($uriPath));
     $requestPattern = new UriPattern(['uriPattern' => $pattern]);
     if ($shouldMatch) {
         $this->assertTrue($requestPattern->matchRequest($mockActionRequest));
     } else {
         $this->assertFalse($requestPattern->matchRequest($mockActionRequest));
     }
 }