Skip to content

Commit 507073d

Browse files
committed
Test custom callbacks
1 parent a843594 commit 507073d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/RouteTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,17 @@ public function testRouteExtra()
5656
public function testComplete()
5757
{
5858
$ctx = new Context(Request::create('/route_extra'));
59+
/** @var Route $route */
5960
$route = Route::i()->add(RequestCondition::i()->path('{pathname}'));
61+
$route->addCompleteCallback(
62+
function (Context $c) {
63+
$c->meta()->set('completed', true);
64+
}
65+
);
6066
$route->match($ctx);
6167
$route->complete($ctx);
6268
$this->assertEquals('route_extra', $ctx->routeData()->get('pathname'));
69+
$this->assertTrue($ctx->meta()->getBoolean('completed'));
6370
}
6471

6572
/**

0 commit comments

Comments
 (0)