File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 33namespace App \Test \Route ;
44
55use App \Route \Router ;
6+ use InvalidArgumentException ;
7+ use PHPUnit \Framework \TestCase ;
68
7- class RouterTest extends \PHPUnit_Framework_TestCase
9+ class RouterTest extends TestCase
810{
11+ public function test_RouteDispatch_ShouldThrowInvalidArgumentException_WhenGivenAnUnregisteredRoute (): void
12+ {
13+ $ unregisteredRoute = '/unregistered-route ' ;
14+ $ notFoundCode = 204 ;
915
16+ $ route = new Router ();
17+ $ route ->registry ('/user ' , \App \User \UserController::class, 'index ' );
18+
19+ $ this ->expectException (InvalidArgumentException::class);
20+ $ this ->expectExceptionMessage ("' {$ unregisteredRoute }' is an unregistered route " );
21+ $ this ->expectExceptionCode ($ notFoundCode );
22+
23+ $ route ->dispatch ($ unregisteredRoute );
24+ }
1025}
You can’t perform that action at this time.
0 commit comments