class MockMatcher
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Routing/MockMatcher.php \Drupal\Tests\system\Functional\Routing\MockMatcher
- 10 core/modules/system/tests/src/Functional/Routing/MockMatcher.php \Drupal\Tests\system\Functional\Routing\MockMatcher
- 11.x core/modules/system/tests/src/Functional/Routing/MockMatcher.php \Drupal\Tests\system\Functional\Routing\MockMatcher
A mock matcher that can be configured with any matching logic for testing.
Hierarchy
- class \Drupal\Tests\system\Functional\Routing\MockMatcher implements \Symfony\Component\Routing\Matcher\RequestMatcherInterface
Expanded class hierarchy of MockMatcher
File
-
core/
modules/ system/ tests/ src/ Functional/ Routing/ MockMatcher.php, line 11
Namespace
Drupal\Tests\system\Functional\RoutingView source
class MockMatcher implements 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;
}
/**
* {@inheritdoc}
*/
public function matchRequest(Request $request) {
$matcher = $this->matcher;
return $matcher($request);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
MockMatcher::$matcher | protected | property | The matcher being tested. |
MockMatcher::matchRequest | public | function | |
MockMatcher::__construct | public | function | Constructs a MockMatcher object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.