@@ -158,4 +158,52 @@ public function testCancelBrancherAppRaisesServerExceptions()
158158
159159 $ this ->client ->brancherApp ->cancel ('johndoe ' );
160160 }
161+
162+ public function testUpdateBrancherApp ()
163+ {
164+ $ this ->responses ->append (
165+ new Response (200 , [], json_encode ([
166+ 'labels ' => ['somekey ' => 'somevalue ' ]
167+ ])),
168+ );
169+
170+ $ result = $ this ->client ->brancherApp ->update ('johndoe-eph123456 ' , ['labels ' => ['somekey=somevalue ' ]]);
171+
172+ $ request = $ this ->responses ->getLastRequest ();
173+ $ this ->assertEquals ('PUT ' , $ request ->getMethod ());
174+ $ this ->assertEquals ('/v2/brancher/johndoe-eph123456/ ' , $ request ->getUri ());
175+ $ this ->assertJson ((string )$ request ->getBody ());
176+ $ this ->assertEquals (
177+ ['labels ' => ['somekey=somevalue ' ]],
178+ json_decode ((string )$ request ->getBody (), true )
179+ );
180+ $ this ->assertEquals (
181+ ['labels ' => ['somekey ' => 'somevalue ' ]],
182+ $ result
183+ );
184+ }
185+
186+ public function testUpdateBrancherAppRaisesClientExceptions ()
187+ {
188+ $ badRequestResponse = new Response (400 , [], json_encode ([
189+ 'non_field_errors ' => ['Your request was invalid. ' ]
190+ ]));
191+ $ this ->responses ->append ($ badRequestResponse );
192+
193+ $ this ->expectExceptionObject (new HypernodeApiClientException ($ badRequestResponse ));
194+
195+ $ this ->client ->brancherApp ->update ('johndoe ' , ['labels ' => []]);
196+ }
197+
198+ public function testUpdateBrancherAppRaisesServerExceptions ()
199+ {
200+ $ badRequestResponse = new Response (500 , [], json_encode ([
201+ 'non_field_errors ' => ['Something went wrong processing your request. ' ]
202+ ]));
203+ $ this ->responses ->append ($ badRequestResponse );
204+
205+ $ this ->expectExceptionObject (new HypernodeApiServerException ($ badRequestResponse ));
206+
207+ $ this ->client ->brancherApp ->update ('johndoe ' , ['labels ' => []]);
208+ }
161209}
0 commit comments