@@ -73,6 +73,31 @@ public function it_registers_a_root_route_for_each_locale()
7373 $ this ->assertContains ('nl ' , $ uris );
7474 }
7575
76+ /** @test */
77+ public function it_registers_a_url_without_prefix_for_a_configured_main_locale ()
78+ {
79+ $ this ->setAvailableLocales (['en ' , 'nl ' ]);
80+
81+ Config::set ('localized-routes.omit_url_prefix_for_locale ' , 'en ' );
82+
83+ Route::localized (function () {
84+ Route::get ('about ' , function () {})
85+ ->name ('about ' );
86+ });
87+
88+ $ routes = $ this ->getRoutes ();
89+ $ names = $ routes ->pluck ('action.as ' );
90+ $ uris = $ routes ->pluck ('uri ' );
91+
92+ $ this ->assertNotContains ('about ' , $ names );
93+ $ this ->assertContains ('en.about ' , $ names );
94+ $ this ->assertContains ('nl.about ' , $ names );
95+
96+ $ this ->assertNotContains ('en/about ' , $ uris );
97+ $ this ->assertContains ('about ' , $ uris );
98+ $ this ->assertContains ('nl/about ' , $ uris );
99+ }
100+
76101 /** @test */
77102 public function it_maps_a_custom_domain_to_each_locale ()
78103 {
@@ -99,31 +124,6 @@ public function it_maps_a_custom_domain_to_each_locale()
99124 $ this ->assertEquals ('/ ' , $ route ->uri );
100125 }
101126
102- /** @test */
103- public function it_registers_a_url_without_prefix_for_a_configured_main_locale ()
104- {
105- $ this ->setAvailableLocales (['en ' , 'nl ' ]);
106-
107- Config::set ('localized-routes.omit_url_prefix_for_locale ' , 'en ' );
108-
109- Route::localized (function () {
110- Route::get ('about ' , function () {})
111- ->name ('about ' );
112- });
113-
114- $ routes = $ this ->getRoutes ();
115- $ names = $ routes ->pluck ('action.as ' );
116- $ uris = $ routes ->pluck ('uri ' );
117-
118- $ this ->assertNotContains ('about ' , $ names );
119- $ this ->assertContains ('en.about ' , $ names );
120- $ this ->assertContains ('nl.about ' , $ names );
121-
122- $ this ->assertNotContains ('en/about ' , $ uris );
123- $ this ->assertContains ('about ' , $ uris );
124- $ this ->assertContains ('nl/about ' , $ uris );
125- }
126-
127127 /** @test */
128128 public function it_temporarily_changes_the_app_locale_when_registering_the_routes ()
129129 {
0 commit comments