CodeIgniter Forums
How to test filters are active on route? - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: How to test filters are active on route? (/thread-79404.html)

How to test filters are active on route? - tgix - 06-10-2021

Upgraded to 4.1.3 just to be able to start adding tests to my project but fails miserably on the first hurdle.
I have many, many routes configured (~100) and most of them require a JWT token with specific privileges. When trying the steps from I get nothing in return from any of the routes tested. I know there are filters defined because they run with the requests coming in normally.

In my test:
PHP Code:
public function testFiltersForAdminRoutes() {

In my Config/Routes.php
PHP Code:
$routes->group('companies', ['filter' => 'bearer-auth:comp'], function($routes) {

What gets me puzzled is this line from the description of Filter Testing:
Quote:$filtersConfig The default Config\Filters configuration (note: discovery is handle by Filters so this will not include module aliases)

All filters I have designed are aliases defined in Config/Filters.php - can I not do that?
I am trying to make sure the correct filters are executed based on the route - is that not possible?

Any help greatly appreciated!