@@ -340,6 +340,66 @@ public function it_generates_a_temporary_signed_route_url_for_a_specific_locale(
340340 $ this ->get ($ expiredUrl )->assertSee ('Expired Signature ' );
341341 }
342342
343+ /** @test */
344+ public function it_throws_a_route_not_found_exception_for_missing_route_names_when_generating_a_route_url ()
345+ {
346+ $ this ->expectException (RouteNotFoundException::class);
347+
348+ URL ::route ('missing.route ' );
349+ }
350+
351+ /** @test */
352+ public function the_app_locale_is_correctly_restored_when_catching_a_route_not_found_exception_when_generating_a_route_url ()
353+ {
354+ $ this ->setAppLocale ('en ' );
355+
356+ try {
357+ URL ::route ('missing.route ' , [], true , 'nl ' );
358+ } catch (RouteNotFoundException $ exception ) {}
359+
360+ $ this ->assertEquals ('en ' , App::getLocale ());
361+ }
362+
363+ /** @test */
364+ public function it_throws_a_route_not_found_exception_for_missing_route_names_when_generating_a_signed_route_url ()
365+ {
366+ $ this ->expectException (RouteNotFoundException::class);
367+
368+ URL ::signedRoute ('missing.route ' );
369+ }
370+
371+ /** @test */
372+ public function the_app_locale_is_correctly_restored_when_catching_a_route_not_found_exception_when_generating_a_signed_route_url ()
373+ {
374+ $ this ->setAppLocale ('en ' );
375+
376+ try {
377+ URL ::signedRoute ('missing.route ' , [], null , true , 'nl ' );
378+ } catch (RouteNotFoundException $ exception ) {}
379+
380+ $ this ->assertEquals ('en ' , App::getLocale ());
381+ }
382+
383+ /** @test */
384+ public function it_throws_a_route_not_found_exception_for_missing_route_names_when_generating_a_temporary_signed_route_url ()
385+ {
386+ $ this ->expectException (RouteNotFoundException::class);
387+
388+ URL ::temporarySignedRoute ('missing.route ' , now ()->addMinutes (30 ));
389+ }
390+
391+ /** @test */
392+ public function the_app_locale_is_correctly_restored_when_catching_a_route_not_found_exception_when_generating_a_temporary_signed_route_url ()
393+ {
394+ $ this ->setAppLocale ('en ' );
395+
396+ try {
397+ URL ::temporarySignedRoute ('missing.route ' , now ()->addMinutes (30 ), [], true , 'nl ' );
398+ } catch (RouteNotFoundException $ exception ) {}
399+
400+ $ this ->assertEquals ('en ' , App::getLocale ());
401+ }
402+
343403 /** @test */
344404 public function it_allows_routes_to_be_cached ()
345405 {
0 commit comments