3 namespace Drupal\Tests\system\Functional\Routing;
5 use Symfony\Component\HttpFoundation\Request;
6 use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
9 * A mock matcher that can be configured with any matching logic for testing.
11 class MockMatcher implements RequestMatcherInterface {
14 * The matcher being tested.
19 * Constructs a MockMatcher object.
21 * @param \Closure $matcher
22 * An anonymous function that will be used for the matchRequest() method.
24 public function __construct(\Closure $matcher) {
25 $this->matcher = $matcher;
31 public function matchRequest(Request $request) {
32 $matcher = $this->matcher;
33 return $matcher($request);