@@ -25,22 +25,38 @@ function it_is_initializable(): void
2525 $ this ->shouldHaveType (OperationRouteNameFactory::class);
2626 }
2727
28- function it_create_a_route_name (): void
28+ function it_creates_a_route_name (): void
2929 {
3030 $ resource = new ResourceMetadata (alias: 'app.book ' , name: 'book ' , applicationName: 'app ' );
3131 $ operation = (new Create ())->withResource ($ resource );
3232
3333 $ this ->createRouteName ($ operation )->shouldReturn ('app_book_create ' );
3434 }
3535
36- function it_create_a_route_name_with_a_section (): void
36+ function it_uses_the_operation_name_when_specified (): void
37+ {
38+ $ resource = new ResourceMetadata (alias: 'app.book ' , name: 'book ' , applicationName: 'app ' );
39+ $ operation = (new Create (name: 'app_book_new ' ))->withResource ($ resource );
40+
41+ $ this ->createRouteName ($ operation )->shouldReturn ('app_book_new ' );
42+ }
43+
44+ function it_creates_a_route_name_with_a_section (): void
3745 {
3846 $ resource = new ResourceMetadata (alias: 'app.book ' , section: 'admin ' , name: 'book ' , applicationName: 'app ' );
3947 $ operation = (new Create ())->withResource ($ resource );
4048
4149 $ this ->createRouteName ($ operation )->shouldReturn ('app_admin_book_create ' );
4250 }
4351
52+ function it_creates_a_route_name_from_another_operation (): void
53+ {
54+ $ resource = new ResourceMetadata (alias: 'app.book ' , name: 'book ' , applicationName: 'app ' );
55+ $ operation = (new Create ())->withResource ($ resource );
56+
57+ $ this ->createRouteName ($ operation , 'index ' )->shouldReturn ('app_book_index ' );
58+ }
59+
4460 function it_throws_an_exception_when_operation_has_no_resource (): void
4561 {
4662 $ operation = new Create ();
0 commit comments