@@ -272,6 +272,14 @@ public function testSetDefaultControllerStoresIt(): void
272272 $ this ->assertSame ('godzilla ' , $ routes ->getDefaultController ());
273273 }
274274
275+ public function testSetDefaultControllerPreservesSpecialCharacters (): void
276+ {
277+ $ routes = $ this ->getCollector ();
278+ $ routes ->setDefaultController ('Foo&Bar ' );
279+
280+ $ this ->assertSame ('Foo&Bar ' , $ routes ->getDefaultController ());
281+ }
282+
275283 public function testSetDefaultMethodStoresIt (): void
276284 {
277285 $ routes = $ this ->getCollector ();
@@ -280,6 +288,22 @@ public function testSetDefaultMethodStoresIt(): void
280288 $ this ->assertSame ('biggerBox ' , $ routes ->getDefaultMethod ());
281289 }
282290
291+ public function testSetDefaultMethodPreservesSpecialCharacters (): void
292+ {
293+ $ routes = $ this ->getCollector ();
294+ $ routes ->setDefaultMethod ('get&set ' );
295+
296+ $ this ->assertSame ('get&set ' , $ routes ->getDefaultMethod ());
297+ }
298+
299+ public function testSetDefaultNamespacePreservesSpecialCharacters (): void
300+ {
301+ $ routes = $ this ->getCollector ();
302+ $ routes ->setDefaultNamespace ('App\Controllers&Services ' );
303+
304+ $ this ->assertSame ('App\Controllers&Services \\' , $ routes ->getDefaultNamespace ());
305+ }
306+
283307 public function testTranslateURIDashesWorks (): void
284308 {
285309 $ routes = $ this ->getCollector ();
@@ -732,7 +756,7 @@ public function testResourcesWithCustomController(): void
732756 service ('request ' )->setMethod (Method::GET );
733757 $ routes = $ this ->getCollector ();
734758
735- $ routes ->resource ('photos ' , ['controller ' => '<script> gallery ' ]);
759+ $ routes ->resource ('photos ' , ['controller ' => 'gallery ' ]);
736760
737761 $ expected = [
738762 'photos ' => '\Gallery::index ' ,
@@ -744,6 +768,25 @@ public function testResourcesWithCustomController(): void
744768 $ this ->assertSame ($ expected , $ routes ->getRoutes ());
745769 }
746770
771+ public function testPresenterWithCustomController (): void
772+ {
773+ service ('request ' )->setMethod (Method::GET );
774+ $ routes = $ this ->getCollector ();
775+
776+ $ routes ->presenter ('photos ' , ['controller ' => 'gallery ' ]);
777+
778+ $ expected = [
779+ 'photos ' => '\Gallery::index ' ,
780+ 'photos/show/(.*) ' => '\Gallery::show/$1 ' ,
781+ 'photos/new ' => '\Gallery::new ' ,
782+ 'photos/edit/(.*) ' => '\Gallery::edit/$1 ' ,
783+ 'photos/remove/(.*) ' => '\Gallery::remove/$1 ' ,
784+ 'photos/(.*) ' => '\Gallery::show/$1 ' ,
785+ ];
786+
787+ $ this ->assertSame ($ expected , $ routes ->getRoutes ());
788+ }
789+
747790 public function testResourcesWithCustomPlaceholder (): void
748791 {
749792 service ('request ' )->setMethod (Method::GET );
0 commit comments