@@ -25,10 +25,10 @@ public function testCreateWithClient() {
2525 $ client = new Client (['handler ' => $ handler ]);
2626
2727 // userland code starts
28- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
28+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
2929
30- $ this ->assertObjectHasAttribute (' client ' , $ server );
31- $ this ->assertAttributeInstanceOf ('\GuzzleHttp\ClientInterface ' , ' client ' , $ server );
30+ $ this ->assertObjectHasAttribute (\ PHPCouchDB \Server:: OPTION_CLIENT , $ server );
31+ $ this ->assertAttributeInstanceOf ('\GuzzleHttp\ClientInterface ' , \ PHPCouchDB \Server:: OPTION_CLIENT , $ server );
3232 }
3333
3434 public function testCreateWithUrl () {
@@ -37,10 +37,10 @@ public function testCreateWithUrl() {
3737 $ handler = HandlerStack::create ($ mock );
3838
3939 // userland code starts
40- $ server = new \PHPCouchDB \Server ([" url " => "http://localhost:5984 " ]);
40+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_URL => "http://localhost:5984 " ]);
4141
42- $ this ->assertObjectHasAttribute (' client ' , $ server );
43- $ this ->assertAttributeInstanceOf ('\GuzzleHttp\ClientInterface ' , ' client ' , $ server );
42+ $ this ->assertObjectHasAttribute (\ PHPCouchDB \Server:: OPTION_CLIENT , $ server );
43+ $ this ->assertAttributeInstanceOf ('\GuzzleHttp\ClientInterface ' , \ PHPCouchDB \Server:: OPTION_CLIENT , $ server );
4444
4545 $ config = $ server ->getClient ()->getConfig ();
4646 $ this ->assertArrayHasKey ('User-Agent ' , $ config ['headers ' ]);
@@ -54,7 +54,7 @@ public function testGetVersion() {
5454 $ client = new Client (['handler ' => $ handler ]);
5555
5656 // userland code starts
57- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
57+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
5858 $ this ->assertEquals ("2.0.0 " , $ server ->getVersion ());
5959
6060 }
@@ -68,7 +68,7 @@ public function testGetAllDbs() {
6868 $ client = new Client (['handler ' => $ handler ]);
6969
7070 // userland code starts
71- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
71+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
7272 $ this ->assertEquals ($ dbs , $ server ->getAllDbs ());
7373 }
7474
@@ -81,8 +81,8 @@ public function testUseADbThatDoesExist() {
8181 $ client = new Client (['handler ' => $ handler ]);
8282
8383 // userland code starts
84- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
85- $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb ([" name " => "egdb " ]));
84+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
85+ $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]));
8686 }
8787
8888 public function testUseADbWithCreateThatDoesExist () {
@@ -94,8 +94,10 @@ public function testUseADbWithCreateThatDoesExist() {
9494 $ client = new Client (['handler ' => $ handler ]);
9595
9696 // userland code starts
97- $ server = new \PHPCouchDB \Server (["client " => $ client ]);
98- $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb (["name " => "egdb " , "create_if_not_exists " => false ]));
97+ $ server = new \PHPCouchDB \Server ([\PHPCouchDB \Server::OPTION_CLIENT => $ client ]);
98+ $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb (
99+ [\PHPCouchDB \Server::OPTION_NAME => "egdb " , \PHPCouchDB \Server::OPTION_CREATE_IF_NOT_EXISTS => false ]
100+ ));
99101 }
100102
101103 /**
@@ -110,8 +112,8 @@ public function testUseADbThatDoesNotExist() {
110112 $ client = new Client (['handler ' => $ handler ]);
111113
112114 // userland code starts
113- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
114- $ server ->useDb ([" name " => "egdb " ]);
115+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
116+ $ server ->useDb ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
115117 }
116118
117119 public function testUseADbWithCreateThatDoesNotExist () {
@@ -126,8 +128,10 @@ public function testUseADbWithCreateThatDoesNotExist() {
126128 $ client = new Client (['handler ' => $ handler ]);
127129
128130 // userland code starts
129- $ server = new \PHPCouchDB \Server (["client " => $ client ]);
130- $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb (["name " => "egdb " , "create_if_not_exists " => true ]));
131+ $ server = new \PHPCouchDB \Server ([\PHPCouchDB \Server::OPTION_CLIENT => $ client ]);
132+ $ this ->assertInstanceOf ("\PHPCouchDB\Database " , $ server ->useDb (
133+ [\PHPCouchDB \Server::OPTION_NAME => "egdb " , \PHPCouchDB \Server::OPTION_CREATE_IF_NOT_EXISTS => true ]
134+ ));
131135 }
132136
133137 public function testGetClient () {
@@ -137,7 +141,7 @@ public function testGetClient() {
137141 $ client = new Client (['handler ' => $ handler ]);
138142
139143 // userland code starts
140- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
144+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
141145 $ this ->assertInstanceOf ("\GuzzleHttp\ClientInterface " , $ server ->getClient ());
142146 }
143147}
0 commit comments