Skip to content

Commit

Permalink
test: add the before filter for the case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Sep 12, 2023
1 parent 40c098c commit 5a3d48d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Config\Modules;
use Config\Routing;
use Tests\Support\Filters\Customfilter;
use Tests\Support\Filters\RedirectFilter;

/**
* @backupGlobals enabled
Expand Down Expand Up @@ -941,6 +942,12 @@ public function testRunControllerNotFoundBeforeFilter(): void
$routes = Services::routes();
$routes->setAutoRoute(true);

// Inject the before filter.
$filterConfig = config('Filters');
$filterConfig->aliases['redirectFilter'] = RedirectFilter::class;
$filterConfig->globals['before'] = ['redirectFilter'];
Services::filters($filterConfig);

$this->expectException(PageNotFoundException::class);

$this->codeigniter->run($routes);
Expand Down

0 comments on commit 5a3d48d

Please sign in to comment.