@@ -82,6 +82,40 @@ public function it_registers_a_url_without_prefix_for_a_configured_main_locale()
82
82
$ this ->assertContains ('nl/about ' , $ uris );
83
83
}
84
84
85
+ /** @test */
86
+ public function it_registers_routes_in_the_correct_order_without_prefix_for_a_configured_main_locale ()
87
+ {
88
+ $ this ->setSupportedLocales (['en ' , 'nl ' ]);
89
+ $ this ->setOmitUrlPrefixForLocale ('en ' );
90
+ $ this ->setUseLocaleMiddleware (true );
91
+
92
+ Route::localized (function () {
93
+ Route::get ('/ ' , function () { return 'Home ' .App::getLocale (); });
94
+ Route::get ('{slug} ' , function () { return 'Dynamic ' .App::getLocale (); });
95
+ });
96
+
97
+ $ this ->assertEquals (
98
+ ['nl ' , 'nl/{slug} ' , '/ ' , '{slug} ' ],
99
+ $ this ->getRoutes ()->pluck ('uri ' )->toArray ()
100
+ );
101
+
102
+ $ response = $ this ->call ('GET ' , '/ ' );
103
+ $ response ->assertOk ();
104
+ $ this ->assertEquals ('Home en ' , $ response ->original );
105
+
106
+ $ response = $ this ->call ('GET ' , '/nl ' );
107
+ $ response ->assertOk ();
108
+ $ this ->assertEquals ('Home nl ' , $ response ->original );
109
+
110
+ $ response = $ this ->call ('GET ' , '/dynamic ' );
111
+ $ response ->assertOk ();
112
+ $ this ->assertEquals ('Dynamic en ' , $ response ->original );
113
+
114
+ $ response = $ this ->call ('GET ' , '/nl/dynamic ' );
115
+ $ response ->assertOk ();
116
+ $ this ->assertEquals ('Dynamic nl ' , $ response ->original );
117
+ }
118
+
85
119
/** @test */
86
120
public function it_maps_a_custom_domain_to_each_locale ()
87
121
{
0 commit comments