@@ -30,8 +30,8 @@ public function testGetAllDocs() {
3030 $ client = new Client (['handler ' => $ handler ]);
3131
3232 // userland code starts
33- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
34- $ database = $ server ->useDB ([" name " => "egdb " ]);
33+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
34+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
3535 $ docs = $ database ->getAllDocs ();
3636
3737 $ this ->assertInternalType ('array ' , $ docs );
@@ -50,8 +50,8 @@ public function testGetAllDocsWithNoDocs() {
5050 $ client = new Client (['handler ' => $ handler ]);
5151
5252 // userland code starts
53- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
54- $ database = $ server ->useDB ([" name " => "egdb " ]);
53+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
54+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
5555 $ docs = $ database ->getAllDocs ();
5656
5757 $ this ->assertInternalType ('array ' , $ docs );
@@ -67,8 +67,8 @@ public function testCreateWithID() {
6767 $ client = new Client (['handler ' => $ handler ]);
6868
6969 // userland code starts
70- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
71- $ database = $ server ->useDB ([" name " => "egdb " ]);
70+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
71+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
7272 $ doc = $ database ->create (["noise " => "howl " , "id " => "abcde12345 " ]);
7373
7474 $ this ->assertInstanceOf ('PHPCouchDB\Document ' , $ doc );
@@ -85,8 +85,8 @@ public function testCreateWithoutID() {
8585 $ client = new Client (['handler ' => $ handler ]);
8686
8787 // userland code starts
88- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
89- $ database = $ server ->useDB ([" name " => "egdb " ]);
88+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
89+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
9090 $ doc = $ database ->create (["noise " => "howl " ]);
9191
9292 $ this ->assertInstanceOf ('PHPCouchDB\Document ' , $ doc );
@@ -105,8 +105,8 @@ public function testGetDocById() {
105105 $ client = new Client (['handler ' => $ handler ]);
106106
107107 // userland code starts
108- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
109- $ database = $ server ->useDB ([" name " => "egdb " ]);
108+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
109+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
110110 $ doc = $ database ->create (["noise " => "crackle " ]);
111111
112112 $ fetched_doc = $ database ->getDocById ($ doc ->id );
@@ -122,8 +122,8 @@ public function testGetName() {
122122 $ client = new Client (['handler ' => $ handler ]);
123123
124124 // userland code starts
125- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
126- $ database = $ server ->useDB ([" name " => "egdb " ]);
125+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
126+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
127127
128128 $ this ->assertInternalType ('string ' , $ database ->getName ());
129129 }
@@ -135,8 +135,8 @@ public function testGetClient() {
135135 $ client = new Client (['handler ' => $ handler ]);
136136
137137 // userland code starts
138- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
139- $ database = $ server ->useDB ([" name " => "egdb " ]);
138+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
139+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
140140
141141 $ this ->assertInstanceOf ('\GuzzleHttp\ClientInterface ' , $ database ->getClient ());
142142 }
@@ -154,9 +154,9 @@ public function testAllDocsWithoutIncludeDocs() {
154154 $ client = new Client (['handler ' => $ handler ]);
155155
156156 // userland code starts
157- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
158- $ database = $ server ->useDB ([" name " => "egdb " ]);
159- $ docs = $ database ->getAllDocs ([" include_docs " => false ]);
157+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
158+ $ database = $ server ->useDB ([\ PHPCouchDB \Server:: OPTION_NAME => "egdb " ]);
159+ $ docs = $ database ->getAllDocs ([\ PHPCouchDB \Database:: OPTION_INCLUDE_DOCS => false ]);
160160
161161 $ this ->assertInternalType ('array ' , $ docs );
162162 $ this ->assertInternalType ('array ' , $ docs [0 ]);
@@ -178,9 +178,13 @@ public function testView() {
178178 $ client = new Client (['handler ' => $ handler ]);
179179
180180 // userland code starts
181- $ server = new \PHPCouchDB \Server (["client " => $ client ]);
182- $ database = $ server ->useDB (["name " => "egdb " ]);
183- $ docs = $ database ->getView (["ddoc " => "myview " , "view " => "year " , "group " => true ]);
181+ $ server = new \PHPCouchDB \Server ([\PHPCouchDB \Server::OPTION_CLIENT => $ client ]);
182+ $ database = $ server ->useDB ([\PHPCouchDB \Server::OPTION_NAME => "egdb " ]);
183+ $ docs = $ database ->getView ([
184+ \PHPCouchDB \Database::OPTION_DDOC => "myview " ,
185+ \PHPCouchDB \Database::OPTION_VIEW => "year " ,
186+ "group " => true
187+ ]);
184188
185189 $ this ->assertInternalType ('array ' , $ docs );
186190 $ this ->assertEquals (3 , count ($ docs ));
@@ -201,9 +205,15 @@ public function testViewWithIncludeDocs() {
201205 $ client = new Client (['handler ' => $ handler ]);
202206
203207 // userland code starts
204- $ server = new \PHPCouchDB \Server (["client " => $ client ]);
205- $ database = $ server ->useDB (["name " => "egdb " ]);
206- $ docs = $ database ->getView (["ddoc " => "myview " , "view " => "year " , "reduce " => false , "limit " => 3 , "include_docs " => true ]);
208+ $ server = new \PHPCouchDB \Server ([\PHPCouchDB \Server::OPTION_CLIENT => $ client ]);
209+ $ database = $ server ->useDB ([\PHPCouchDB \Server::OPTION_NAME => "egdb " ]);
210+ $ docs = $ database ->getView ([
211+ \PHPCouchDB \Database::OPTION_DDOC => "myview " ,
212+ \PHPCouchDB \Database::OPTION_VIEW => "year " ,
213+ "reduce " => false ,
214+ "limit " => 3 ,
215+ \PHPCouchDB \Database::OPTION_INCLUDE_DOCS => true
216+ ]);
207217
208218 $ this ->assertInternalType ('array ' , $ docs );
209219 $ this ->assertEquals (3 , count ($ docs ));
0 commit comments