Skip to content

Commit bc1f279

Browse files
committed
test: add test for except empty array
1 parent 84c28a9 commit bc1f279

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

tests/system/Filters/FiltersTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,40 @@ public function testBeforeExceptInapplicable(): void
639639
$this->assertSame($expected, $filters->initialize($uri)->getFilters());
640640
}
641641

642+
public function testBeforeExceptEmptyArray(): void
643+
{
644+
$_SERVER['REQUEST_METHOD'] = 'GET';
645+
646+
$config = [
647+
'aliases' => [
648+
'foo' => '',
649+
'bar' => '',
650+
'baz' => '',
651+
],
652+
'globals' => [
653+
'before' => [
654+
'foo' => ['except' => []],
655+
'bar',
656+
],
657+
'after' => [
658+
'baz',
659+
],
660+
],
661+
];
662+
$filtersConfig = $this->createConfigFromArray(FiltersConfig::class, $config);
663+
$filters = $this->createFilters($filtersConfig);
664+
665+
$uri = 'admin/foo/bar';
666+
$expected = [
667+
'before' => [
668+
'foo',
669+
'bar',
670+
],
671+
'after' => ['baz'],
672+
];
673+
$this->assertSame($expected, $filters->initialize($uri)->getFilters());
674+
}
675+
642676
public function testAfterExceptString(): void
643677
{
644678
$_SERVER['REQUEST_METHOD'] = 'GET';

0 commit comments

Comments
 (0)