@@ -184,7 +184,7 @@ public function you_can_pass_it_a_closure_that_returns_the_parameters_without_ro
184184 }
185185
186186 /** @test */
187- public function it_returns_the_current_url_for_non_localized_routes ()
187+ public function it_returns_the_current_url_for_existing_non_localized_routes ()
188188 {
189189 $ this ->setSupportedLocales (['en ' , 'nl ' ]);
190190
@@ -194,7 +194,7 @@ public function it_returns_the_current_url_for_non_localized_routes()
194194 'en ' => Route::localizedUrl ('en ' ),
195195 'nl ' => Route::localizedUrl ('nl ' ),
196196 ];
197- });
197+ })-> name ( ' non.localized.route ' ) ;
198198
199199 $ response = $ this ->call ('GET ' , '/non/localized/route ' );
200200 $ response ->assertOk ();
@@ -206,13 +206,16 @@ public function it_returns_the_current_url_for_non_localized_routes()
206206 }
207207
208208 /** @test */
209- public function nothing_happens_in_case_of_a_404 ()
209+ public function the_macro_does_not_blow_up_on_a_default_404_error ()
210210 {
211+ // Although a default 404 has no Route::current(), the composer still triggers.
212+ // Custom 404 views that trigger the macro still don't have a Route::current().
211213 View::composer ('* ' , function ($ view ) {
212214 $ view ->with ('url ' , Route::localizedUrl ());
213215 });
214216
215217 $ response = $ this ->get ('/en/route/does/not/exist ' );
216218 $ response ->assertNotFound ();
219+ $ response ->assertResponseHasNoView ();
217220 }
218221}
0 commit comments