@@ -30,8 +30,8 @@ public function testGetAllDocs() {
30
30
$ client = new Client (['handler ' => $ handler ]);
31
31
32
32
// 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 " ]);
35
35
$ docs = $ database ->getAllDocs ();
36
36
37
37
$ this ->assertInternalType ('array ' , $ docs );
@@ -50,8 +50,8 @@ public function testGetAllDocsWithNoDocs() {
50
50
$ client = new Client (['handler ' => $ handler ]);
51
51
52
52
// 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 " ]);
55
55
$ docs = $ database ->getAllDocs ();
56
56
57
57
$ this ->assertInternalType ('array ' , $ docs );
@@ -67,8 +67,8 @@ public function testCreateWithID() {
67
67
$ client = new Client (['handler ' => $ handler ]);
68
68
69
69
// 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 " ]);
72
72
$ doc = $ database ->create (["noise " => "howl " , "id " => "abcde12345 " ]);
73
73
74
74
$ this ->assertInstanceOf ('PHPCouchDB\Document ' , $ doc );
@@ -85,8 +85,8 @@ public function testCreateWithoutID() {
85
85
$ client = new Client (['handler ' => $ handler ]);
86
86
87
87
// 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 " ]);
90
90
$ doc = $ database ->create (["noise " => "howl " ]);
91
91
92
92
$ this ->assertInstanceOf ('PHPCouchDB\Document ' , $ doc );
@@ -105,8 +105,8 @@ public function testGetDocById() {
105
105
$ client = new Client (['handler ' => $ handler ]);
106
106
107
107
// 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 " ]);
110
110
$ doc = $ database ->create (["noise " => "crackle " ]);
111
111
112
112
$ fetched_doc = $ database ->getDocById ($ doc ->id );
@@ -122,8 +122,8 @@ public function testGetName() {
122
122
$ client = new Client (['handler ' => $ handler ]);
123
123
124
124
// 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 " ]);
127
127
128
128
$ this ->assertInternalType ('string ' , $ database ->getName ());
129
129
}
@@ -135,8 +135,8 @@ public function testGetClient() {
135
135
$ client = new Client (['handler ' => $ handler ]);
136
136
137
137
// 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 " ]);
140
140
141
141
$ this ->assertInstanceOf ('\GuzzleHttp\ClientInterface ' , $ database ->getClient ());
142
142
}
@@ -154,9 +154,9 @@ public function testAllDocsWithoutIncludeDocs() {
154
154
$ client = new Client (['handler ' => $ handler ]);
155
155
156
156
// 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 ]);
160
160
161
161
$ this ->assertInternalType ('array ' , $ docs );
162
162
$ this ->assertInternalType ('array ' , $ docs [0 ]);
@@ -178,9 +178,13 @@ public function testView() {
178
178
$ client = new Client (['handler ' => $ handler ]);
179
179
180
180
// 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
+ ]);
184
188
185
189
$ this ->assertInternalType ('array ' , $ docs );
186
190
$ this ->assertEquals (3 , count ($ docs ));
@@ -201,9 +205,15 @@ public function testViewWithIncludeDocs() {
201
205
$ client = new Client (['handler ' => $ handler ]);
202
206
203
207
// 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
+ ]);
207
217
208
218
$ this ->assertInternalType ('array ' , $ docs );
209
219
$ this ->assertEquals (3 , count ($ docs ));
0 commit comments