Skip to content

Commit ad18afc

Browse files
authored
Add test for empty middleware groups (#42188)
1 parent b453191 commit ad18afc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Integration/Routing/FluentRoutingTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ public function testMiddlewareRunWhenRegisteredAsArrayOrParams()
4646
$this->assertSame('1_2', $this->get('before_after')->content());
4747
$this->assertSame('1_2', $this->get('both_before')->content());
4848
$this->assertSame('1_2', $this->get('both_after')->content());
49+
$this->assertSame('1_2', $this->get('both_after')->content());
50+
}
51+
52+
public function testEmptyMiddlewareGroupAreHandledGracefully()
53+
{
54+
$controller = function () {
55+
return 'Hello World';
56+
};
57+
58+
Route::middlewareGroup('public', []);
59+
60+
Route::middleware('public')
61+
->get('public', $controller);
62+
63+
$this->assertSame('Hello World', $this->get('public')->content());
4964
}
5065
}
5166

0 commit comments

Comments
 (0)