InterNations\Component\HttpMock\Matcher\ExtractorFactory::createPathExtractor PHP Method

createPathExtractor() public method

public createPathExtractor ( )
    public function createPathExtractor()
    {
        $basePath = $this->basePath;
        return static function (Request $request) use($basePath) {
            return substr_replace($request->getRequestUri(), '', 0, strlen($basePath));
        };
    }

Usage Example

 public function testGetPathWithBasePathThatDoesNotMatch()
 {
     $this->request->expects($this->once())->method('getRequestUri')->will($this->returnValue('/bar'));
     $extractorFactory = new ExtractorFactory('/foo');
     $extractor = $extractorFactory->createPathExtractor();
     $this->assertSame('', $extractor($this->request));
 }
All Usage Examples Of InterNations\Component\HttpMock\Matcher\ExtractorFactory::createPathExtractor