Skip to content

Commit 0f830e9

Browse files
committed
create test for listing tasks and updating task with document generation tags.
1 parent bc5fa65 commit 0f830e9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/PhpSdkTests.php

+29
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,35 @@ public function testInvalidTaskCreationWithMultipleErrors() {
187187
$this->assertNotNull($exception);
188188
$this->assertEquals(2, count($exception->Items));
189189
}
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+
190219
public function init() {
191220
$this->url = "https://test-api.nfleet.fi";
192221
$this->user = "clientkey";

0 commit comments

Comments
 (0)