Skip to content

Commit

Permalink
Test custom callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Oct 29, 2020
1 parent a843594 commit 507073d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,17 @@ public function testRouteExtra()
public function testComplete()
{
$ctx = new Context(Request::create('/route_extra'));
/** @var Route $route */
$route = Route::i()->add(RequestCondition::i()->path('{pathname}'));
$route->addCompleteCallback(
function (Context $c) {
$c->meta()->set('completed', true);
}
);
$route->match($ctx);
$route->complete($ctx);
$this->assertEquals('route_extra', $ctx->routeData()->get('pathname'));
$this->assertTrue($ctx->meta()->getBoolean('completed'));
}

/**
Expand Down

0 comments on commit 507073d

Please sign in to comment.