public function testUsingCallbacksBeforeMatchRoute()
{
$this->specify('The Route::beforeMatch does not use callback as expected', function () {
$router = $this->getRouter(false);
$trace = 0;
$router->add('/static/route')->beforeMatch(function () use(&$trace) {
$trace++;
return false;
});
$router->add('/static/route2')->beforeMatch(function () use(&$trace) {
$trace++;
return true;
});
$router->handle();
expect($router->wasMatched())->false();
$router->handle('/static/route');
expect($router->wasMatched())->false();
$router->handle('/static/route2');
expect($router->wasMatched())->true();
expect($trace)->equals(2);
});
}