Skip to content

Commit a8890e1

Browse files
committed
test: add test for discovering module filters
1 parent 0965002 commit a8890e1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/system/Filters/FiltersTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,24 @@ public function testCustomFiltersLoad()
458458
$this->assertSame('http://hellowworld.com', $request->url);
459459
}
460460

461+
/**
462+
* @see https://github.com/codeigniter4/CodeIgniter4/issues/4720
463+
*/
464+
public function testAllCustomFiltersAreDiscoveredInConstructor()
465+
{
466+
$_SERVER['REQUEST_METHOD'] = 'GET';
467+
468+
$config = [
469+
'aliases' => [],
470+
'globals' => [],
471+
];
472+
$filtersConfig = $this->createConfigFromArray(FiltersConfig::class, $config);
473+
$filters = $this->createFilters($filtersConfig);
474+
475+
$configFilters = $this->getPrivateProperty($filters, 'config');
476+
$this->assertContains('test-customfilter', array_keys($configFilters->aliases));
477+
}
478+
461479
public function testRunThrowsWithInvalidClassType()
462480
{
463481
$_SERVER['REQUEST_METHOD'] = 'GET';

0 commit comments

Comments
 (0)