/** * @test */ public function shouldInvokeFunctionCallback() { //given SampleController::$beforeActionResult = true; SampleController::$beforeCallback = function ($controller) { $controller->redirect('url'); return true; }; Route::any('/sample/action', 'sample#action'); //when $this->get('/sample/action'); //then $this->assertRedirectsTo('url'); }