A mock matcher that can be configured with any matching logic for testing.
Expanded class hierarchy of MockMatcher
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;
}
/**
* Implements \Symfony\Component\Routing\Matcher\RequestMatcherInterface::matchRequest().
*/
public function matchRequest(Request $request) {
$matcher = $this->matcher;
return $matcher($request);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MockMatcher:: |
protected | property | The matcher being tested. | |
MockMatcher:: |
public | function |
Implements \Symfony\Component\Routing\Matcher\RequestMatcherInterface::matchRequest(). Overrides RequestMatcherInterface:: |
|
MockMatcher:: |
public | function | Constructs a MockMatcher object. |