File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public function update()
84
84
return $ newrev ;
85
85
} catch (\GuzzleHTTP \Exception \ClientException $ e ) {
86
86
// is it a conflict? Or something else?
87
- if ($ e ->getResponse ()->getStatusCode () == 409 ) {
87
+ if ($ e ->getResponse ()->getStatusCode () == 409 ) {
88
88
throw new Exception \DocumentConflictException ('Conflict. Outdated or missing revision information ' );
89
89
} else {
90
90
throw new Exception \DatabseException ('The update failed ' , 0 , $ e );
Original file line number Diff line number Diff line change 5
5
class DocumentConflictException extends \Exception
6
6
{
7
7
}
8
-
Original file line number Diff line number Diff line change @@ -123,4 +123,30 @@ public function testGetDocById() {
123
123
$ this ->assertInstanceOf ('PHPCouchDB\Document ' , $ fetched_doc );
124
124
$ this ->assertObjectHasAttribute ('id ' , $ fetched_doc );
125
125
}
126
+
127
+ public function testGetName () {
128
+ $ mock = new MockHandler ([ $ this ->db_response , $ this ->use_response ]);
129
+
130
+ $ handler = HandlerStack::create ($ mock );
131
+ $ client = new Client (['handler ' => $ handler ]);
132
+
133
+ // userland code starts
134
+ $ server = new \PHPCouchDB \Server (["client " => $ client ]);
135
+ $ database = $ server ->useDB (["name " => "egdb " ]);
136
+
137
+ $ this ->assertInternalType ('string ' , $ database ->getName ());
138
+ }
139
+
140
+ public function testGetClient () {
141
+ $ mock = new MockHandler ([ $ this ->db_response , $ this ->use_response ]);
142
+
143
+ $ handler = HandlerStack::create ($ mock );
144
+ $ client = new Client (['handler ' => $ handler ]);
145
+
146
+ // userland code starts
147
+ $ server = new \PHPCouchDB \Server (["client " => $ client ]);
148
+ $ database = $ server ->useDB (["name " => "egdb " ]);
149
+
150
+ $ this ->assertInstanceOf ('\GuzzleHttp\ClientInterface ' , $ database ->getClient ());
151
+ }
126
152
}
You can’t perform that action at this time.
0 commit comments