@@ -23,7 +23,7 @@ public function testConnectSetsSearchPath(): void
2323
2424 $ driverConnection ->expects ($ this ->once ())
2525 ->method ('exec ' )
26- ->with ('SET search_path TO test_schema ' );
26+ ->with ('SET search_path TO " test_schema" ' );
2727
2828 $ driver = $ this ->createMock (Driver::class);
2929
@@ -49,6 +49,38 @@ public function testConnectSetsSearchPath(): void
4949 self ::assertTrue ($ result );
5050 }
5151
52+ public function testConnectSetsSearchPathWithSpecialChars (): void
53+ {
54+ $ driverConnection = $ this ->createMock (DriverConnection::class);
55+
56+ $ driverConnection ->expects ($ this ->once ())
57+ ->method ('exec ' )
58+ ->with ('SET search_path TO "test-schema/foo" ' );
59+
60+ $ driver = $ this ->createMock (Driver::class);
61+
62+ $ driver ->method ('connect ' )->willReturn ($ driverConnection );
63+
64+ $ platform = new PostgreSQLPlatform ();
65+ $ connection = $ this ->getMockBuilder (SchemaConnection::class)
66+ ->setConstructorArgs ([[], $ driver , new Configuration (), new EventManager ()])
67+ ->onlyMethods (['getDatabasePlatform ' , 'fetchOne ' ])
68+ ->getMock ();
69+
70+ $ connection ->method ('getDatabasePlatform ' )->willReturn ($ platform );
71+ $ connection ->method ('fetchOne ' )->willReturn (true );
72+
73+ $ resolver = new BaggageSchemaResolver ();
74+
75+ $ resolver ->setSchema ('test-schema/foo ' );
76+
77+ SchemaConnection::setSchemaResolver ($ resolver );
78+
79+ $ result = $ connection ->connect ();
80+
81+ self ::assertTrue ($ result );
82+ }
83+
5284 public function testConnectSkipsWhenNoSchema (): void
5385 {
5486 $ driverConnection = $ this ->createMock (DriverConnection::class);
0 commit comments