2
2
3
3
namespace Inertia \Tests ;
4
4
5
- use Illuminate \Routing \RouteCollection ;
6
5
use Illuminate \Support \Facades \Route ;
7
6
8
7
class RouterTest extends TestCase
9
8
{
10
- public function test_configuring_route_via_macro ()
9
+ public function test_inertia_route_macro ()
11
10
{
12
- /** @var \Illuminate\Routing\Route $route */
13
- $ route = Route::inertia ('/ ' , 'Component ' , ['prop1 ' => true , 'prop2 ' => false ]);
14
-
15
- /** @var RouteCollection $collection */
16
- $ collection = Route::getRoutes ();
17
-
18
- $ this ->assertNotEmpty ($ collection ->getRoutes ());
19
- $ this ->assertEquals ($ route , $ collection ->getRoutes ()[0 ]);
11
+ $ route = Route::inertia ('/ ' , 'User/Edit ' , ['user ' => ['name ' => 'Jonathan ' ]]);
12
+ $ routes = Route::getRoutes ();
20
13
14
+ $ this ->assertNotEmpty ($ routes ->getRoutes ());
15
+ $ this ->assertEquals ($ route , $ routes ->getRoutes ()[0 ]);
21
16
$ this ->assertEquals (['GET ' , 'HEAD ' ], $ route ->methods );
22
-
23
17
$ this ->assertEquals ('/ ' , $ route ->uri );
24
-
25
- $ this ->assertEquals ([
26
- 'uses ' => '\Inertia\Controller@__invoke ' ,
27
- 'controller ' => '\Inertia\Controller ' ,
28
- ], $ route ->action );
29
-
30
- $ this ->assertEquals ([
31
- 'component ' => 'Component ' ,
32
- 'props ' => ['prop1 ' => true , 'prop2 ' => false ],
33
- ], $ route ->defaults );
18
+ $ this ->assertEquals (['uses ' => '\Inertia\Controller@__invoke ' , 'controller ' => '\Inertia\Controller ' ], $ route ->action );
19
+ $ this ->assertEquals (['component ' => 'User/Edit ' , 'props ' => ['user ' => ['name ' => 'Jonathan ' ]]], $ route ->defaults );
34
20
}
35
- }
21
+ }
0 commit comments