<?php/**
* @file
* Definition of Drupal\system\Tests\Routing\MockMatcher.
*/namespaceDrupal\system\Tests\Routing;
useSymfony\Component\HttpFoundation\Request;
useSymfony\Component\Routing\Matcher\RequestMatcherInterface;
/**
* A mock matcher that can be configured with any matching logic for testing.
*/class MockMatcherimplements RequestMatcherInterface {
/**
* The matcher being tested.
*/
protected $matcher;
/**
* Constructs a MockMatcher object.
*
* @param \Closure $matcher
* An anonymous function that will be used for the matchRequest() method.
*/
public function__construct(\Closure $matcher) {
$this->matcher = $matcher;
}
/**
* Implements \Symfony\Component\Routing\Matcher\RequestMatcherInterface::matchRequest().
*/
public functionmatchRequest(Request $request) {
$matcher = $this->matcher;
return$matcher($request);
}
}