PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / microsoft / microsoft-graph / tests / Functional / PlannerTest.php
ameliabooking / vendor / microsoft / microsoft-graph / tests / Functional Last commit date
Resources 5 years ago AzureTest.php 1 year ago ContactTest.php 5 years ago DeltaQueryTest.php 1 year ago EventTest.php 5 years ago ExcelTest.php 1 year ago GraphTestBase.php 1 year ago MailTest.php 1 year ago OnedriveTest.php 1 year ago OnenoteTest.php 1 year ago OpenTypeTest.php 1 year ago PlannerTest.php 1 year ago SharepointTest.php 1 year ago TermStoreTest.php 1 year ago TestConstants.php 1 year ago UserTest.php 1 year ago WebhooksTest.php 1 year ago
PlannerTest.php
109 lines
1 <?php
2 use PHPUnit\Framework\TestCase;
3 use Microsoft\Graph\Test\GraphTestBase;
4 use Microsoft\Graph\Model;
5
6 class PlannerTest extends TestCase
7 {
8 private $_client;
9
10 //This test currently does not clean up after itself
11 private $planId;
12 private $planBucket;
13 private $planTask;
14
15 protected function setUp(): void
16 {
17 $graphTestBase = new GraphTestBase();
18 $this->_client = $graphTestBase->graphClient;
19
20 $this->planId = PLAN_ID;
21
22 $bucket = new Model\PlannerBucket();
23 $bucket->setName("Test Bucket");
24 $bucket->setPlanId($this->planId);
25
26 $this->planBucket = $this->_client->createRequest("POST", "/planner/buckets")
27 ->attachBody($bucket)
28 ->setReturnType(Model\PlannerBucket::class)
29 ->execute();
30
31 $task = new Model\PlannerTask();
32 $task->setTitle("Test Task");
33 $task->setPlanId($this->planId);
34 $task->setBucketId($this->planBucket->getId());
35
36 $this->planTask = $this->_client->createRequest("POST", "/planner/tasks")
37 ->attachBody($task)
38 ->setReturnType(Model\PlannerTask::class)
39 ->execute();
40 }
41
42 /**
43 * @group functional
44 */
45 public function testCreateTask()
46 {
47 $newTask = new Model\PlannerTask();
48 $newTask->setTitle("Test 1");
49 $newTask->setPlanId($this->planId);
50 $newTask->setBucketId($this->planBucket->getId());
51
52 $task = $this->_client->createRequest("POST", "/planner/tasks")
53 ->attachBody($newTask)
54 ->setReturnType(Model\PlannerTask::class)
55 ->execute();
56
57 $this->assertEquals($newTask->getTitle(), $task->getTitle());
58 }
59
60 /**
61 * @group functional
62 */
63 public function testUpdateTask()
64 {
65 $me = $this->_client->createRequest("GET", "/me")
66 ->setReturnType(Model\User::class)
67 ->execute();
68 $assignment = new Model\PlannerAssignment();
69 $assignment->setOrderHint(" !");
70 $assignment->setODataType("#microsoft.graph.plannerAssignment");
71
72 $task = $this->_client->createRequest("GET", "/planner/tasks/" . $this->planTask->getId())
73 ->setReturnType(Model\PlannerTask::class)
74 ->execute();
75
76 try {
77 $this->_client->createRequest("PATCH", "/planner/tasks/" . $this->planTask->getId())
78 ->attachBody(array("assignments" => array($me->getId() => $assignment)))
79 ->addHeaders(array("If-Match" => $task->getProperties()["@odata.etag"]))
80 ->execute();
81
82 $updatedTask = $this->_client->createRequest("GET", "/planner/tasks/" . $this->planTask->getId())
83 ->setReturnType(Model\PlannerTask::class)
84 ->execute();
85
86 $this->assertNotNull($updatedTask->getAssignments()->getProperties()[$me->getId()]);
87 } catch (AmeliaGuzzleHttp\Exception\ClientException $e) {
88 print_r($e->getResponse()->getBody()->getContents());
89 }
90
91 }
92
93 public function tearDown(): void
94 {
95 $task = $this->_client->createRequest("GET", "/planner/tasks/" . $this->planTask->getId())
96 ->setReturnType(Model\PlannerTask::class)
97 ->execute();
98 $this->_client->createRequest("DELETE", "/planner/tasks/" . $this->planTask->getId())
99 ->addHeaders(array("If-Match" => $task->getProperties()["@odata.etag"]))
100 ->execute();
101
102 $bucket = $this->_client->createRequest("GET", "/planner/buckets/" . $this->planBucket->getId())
103 ->setReturnType(Model\PlannerBucket::class)
104 ->execute();
105 $this->_client->createRequest("DELETE", "/planner/buckets/" . $this->planBucket->getId())
106 ->addHeaders(array("If-Match" => $bucket->getProperties()["@odata.etag"]))
107 ->execute();
108 }
109 }