@@ -94,6 +94,23 @@ public function it_gets_the_url_of_a_route_in_the_given_locale()
9494 $ this ->assertEquals (url ('nl/route ' ), route ('nl.route.name ' , [], true , 'nl ' ));
9595 }
9696
97+ /** @test */
98+ public function it_gets_the_url_of_a_route_in_the_given_locale_when_using_custom_domains ()
99+ {
100+ $ this ->setSupportedLocales ([
101+ 'en ' => 'en.domain.test ' ,
102+ 'nl ' => 'nl.domain.test ' ,
103+ ]);
104+ $ this ->setAppLocale ('en ' );
105+
106+ $ this ->registerRoute ('route ' , 'en.route.name ' )->domain ('en.domain.test ' );
107+ $ this ->registerRoute ('route ' , 'nl.route.name ' )->domain ('nl.domain.test ' );
108+
109+ $ this ->assertEquals ('http://nl.domain.test/route ' , route ('route.name ' , [], true , 'nl ' ));
110+ $ this ->assertEquals ('http://nl.domain.test/route ' , route ('en.route.name ' , [], true , 'nl ' ));
111+ $ this ->assertEquals ('http://nl.domain.test/route ' , route ('nl.route.name ' , [], true , 'nl ' ));
112+ }
113+
97114 /** @test */
98115 public function it_always_gets_the_url_of_a_localized_route_if_a_locale_is_specified ()
99116 {
@@ -193,10 +210,10 @@ public function it_generates_a_signed_route_url_for_a_specific_locale()
193210 * @param string $name
194211 * @param \Closure|null $callback
195212 *
196- * @return void
213+ * @return \Illuminate\Routing\Route
197214 */
198215 protected function registerRoute ($ url , $ name , $ callback = null )
199216 {
200- Route::name ($ name )->get ($ url , $ callback ?: function () {});
217+ return Route::name ($ name )->get ($ url , $ callback ?: function () {});
201218 }
202219}
0 commit comments