@@ -187,6 +187,35 @@ public function testInvalidTaskCreationWithMultipleErrors() {
187
187
$ this ->assertNotNull ($ exception );
188
188
$ this ->assertEquals (2 , count ($ exception ->Items ));
189
189
}
190
+
191
+ public function testListTasksAndUpdate () {
192
+ $ problem = $ this ->initWithProblem ();
193
+ $ task1 = createTaskWithName ("task1 " );
194
+ $ task2 = createTaskWithName ("task2 " );
195
+ $ tasks = null ;
196
+ $ task = null ;
197
+ try {
198
+ $ this ->api ->navigate (getLink ($ problem , "create-task " ), $ task1 );
199
+ $ this ->api ->navigate (getLink ($ problem , "create-task " ), $ task2 );
200
+
201
+ //##BEGIN EXAMPLE listingtasks##
202
+ $ tasks = $ this ->api ->navigate (getLink ($ problem , "list-tasks " ));
203
+ //##END EXAMPLE##
204
+
205
+ //##BEGIN EXAMPLE updatingtask##
206
+ $ task = $ this ->api ->navigate (getLink ($ tasks ->Items [0 ], "self " ));
207
+ $ task ->Name = "updatedTask1 " ;
208
+ $ this ->api ->navigate (getLink ($ task , "update " ), $ task );
209
+ //##END EXAMPLE##
210
+ $ task = $ this ->api ->navigate (getLink ($ task , "self " ));
211
+ } catch (NFleetException $ ex ) {
212
+ var_dump ($ ex );
213
+ }
214
+
215
+ $ this ->assertEquals (2 , count ($ tasks ->Items ));
216
+ $ this ->assertEquals ("updatedTask1 " , $ task ->Name );
217
+ }
218
+
190
219
public function init () {
191
220
$ this ->url = "https://test-api.nfleet.fi " ;
192
221
$ this ->user = "clientkey " ;
0 commit comments