@@ -25,10 +25,10 @@ public function testCreateWithClient() {
25
25
$ client = new Client (['handler ' => $ handler ]);
26
26
27
27
// userland code starts
28
- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
28
+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
29
29
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 );
32
32
}
33
33
34
34
public function testCreateWithUrl () {
@@ -37,10 +37,10 @@ public function testCreateWithUrl() {
37
37
$ handler = HandlerStack::create ($ mock );
38
38
39
39
// userland code starts
40
- $ server = new \PHPCouchDB \Server ([" url " => "http://localhost:5984 " ]);
40
+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_URL => "http://localhost:5984 " ]);
41
41
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 );
44
44
45
45
$ config = $ server ->getClient ()->getConfig ();
46
46
$ this ->assertArrayHasKey ('User-Agent ' , $ config ['headers ' ]);
@@ -54,7 +54,7 @@ public function testGetVersion() {
54
54
$ client = new Client (['handler ' => $ handler ]);
55
55
56
56
// userland code starts
57
- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
57
+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
58
58
$ this ->assertEquals ("2.0.0 " , $ server ->getVersion ());
59
59
60
60
}
@@ -68,7 +68,7 @@ public function testGetAllDbs() {
68
68
$ client = new Client (['handler ' => $ handler ]);
69
69
70
70
// userland code starts
71
- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
71
+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
72
72
$ this ->assertEquals ($ dbs , $ server ->getAllDbs ());
73
73
}
74
74
@@ -81,8 +81,8 @@ public function testUseADbThatDoesExist() {
81
81
$ client = new Client (['handler ' => $ handler ]);
82
82
83
83
// 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 " ]));
86
86
}
87
87
88
88
public function testUseADbWithCreateThatDoesExist () {
@@ -94,8 +94,10 @@ public function testUseADbWithCreateThatDoesExist() {
94
94
$ client = new Client (['handler ' => $ handler ]);
95
95
96
96
// 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
+ ));
99
101
}
100
102
101
103
/**
@@ -110,8 +112,8 @@ public function testUseADbThatDoesNotExist() {
110
112
$ client = new Client (['handler ' => $ handler ]);
111
113
112
114
// 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 " ]);
115
117
}
116
118
117
119
public function testUseADbWithCreateThatDoesNotExist () {
@@ -126,8 +128,10 @@ public function testUseADbWithCreateThatDoesNotExist() {
126
128
$ client = new Client (['handler ' => $ handler ]);
127
129
128
130
// 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
+ ));
131
135
}
132
136
133
137
public function testGetClient () {
@@ -137,7 +141,7 @@ public function testGetClient() {
137
141
$ client = new Client (['handler ' => $ handler ]);
138
142
139
143
// userland code starts
140
- $ server = new \PHPCouchDB \Server ([" client " => $ client ]);
144
+ $ server = new \PHPCouchDB \Server ([\ PHPCouchDB \Server:: OPTION_CLIENT => $ client ]);
141
145
$ this ->assertInstanceOf ("\GuzzleHttp\ClientInterface " , $ server ->getClient ());
142
146
}
143
147
}
0 commit comments