This repository was archived by the owner on Feb 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
tests/Doctrine/Tests/CouchDB Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ static public function create(array $options)
8888 break ;
8989
9090 case 'path ' :
91- $ options ['dbname ' ] = ltrim ($ value , '/ ' );
91+ $ path = explode ('/ ' , $ value );
92+ $ options ['dbname ' ] = array_pop ($ path );
93+ $ options ['path ' ] = trim (implode ('/ ' , $ path ), '/ ' );
9294 break ;
9395
9496 case 'pass ' :
Original file line number Diff line number Diff line change @@ -44,6 +44,27 @@ public function testCreateClientFromUrl()
4444 );
4545 }
4646
47+ public function testCreateClientFromUrlWithPath ()
48+ {
49+ $ client = CouchDBClient::create (array ('url ' => 'https://foo:bar@localhost:5555/baz/qux/norf ' ));
50+
51+ $ this ->assertEquals ('norf ' , $ client ->getDatabase ());
52+ $ this ->assertEquals (
53+ array (
54+ 'host ' => 'localhost ' ,
55+ 'port ' => 5555 ,
56+ 'ip ' => '127.0.0.1 ' ,
57+ 'username ' => 'foo ' ,
58+ 'password ' => 'bar ' ,
59+ 'ssl ' => true ,
60+ 'timeout ' => 0.01 ,
61+ 'keep-alive ' => true ,
62+ 'path ' => 'baz/qux ' ,
63+ ),
64+ $ client ->getHttpClient ()->getOptions ()
65+ );
66+ }
67+
4768 public function testCreateClientWithLogging ()
4869 {
4970 $ client = CouchDBClient::create (array ('dbname ' => 'test ' , 'logging ' => true ));
You can’t perform that action at this time.
0 commit comments