class MockMatcher

A mock matcher that can be configured with any matching logic for testing.

Hierarchy

Expanded class hierarchy of MockMatcher

File

drupal/core/modules/system/lib/Drupal/system/Tests/Routing/MockMatcher.php, line 22
Definition of Drupal\system\Tests\Routing\MockMatcher.

Namespace

Drupal\system\Tests\Routing
View source
class MockMatcher implements RequestMatcherInterface {

  /**
   * The matcher being tested.
   */
  protected $matcher;
  public function __construct(Closure $matcher) {
    $this->matcher = $matcher;
  }
  public function matchRequest(Request $request) {
    $matcher = $this->matcher;
    return $matcher($request);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MockMatcher::$matcher protected property The matcher being tested.
MockMatcher::matchRequest public function Tries to match a request with a set of routes. Overrides RequestMatcherInterface::matchRequest
MockMatcher::__construct public function