diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 64b6f491fabf..3e740aba2af5 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -26,6 +26,7 @@ use Config\Modules; use Config\Routing; use Tests\Support\Filters\Customfilter; +use Tests\Support\Filters\RedirectFilter; /** * @backupGlobals enabled @@ -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);