ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DeletionTest.php
Go to the documentation of this file.
1<?php
2
20
21use PHPUnit\Framework\TestCase;
22
23class DeletionTest extends TestCase
24{
25 protected array $test_tree_data = [
26 1 => [ // data id
27 1 => [ // tree id
39 1 => ["tree" => 1, "child" => 1, "ref_id" => 1, "obj_id" => 1, "parent" => 0],
40 2 => ["tree" => 1, "child" => 2, "ref_id" => 2, "obj_id" => 2, "parent" => 1],
41 3 => ["tree" => 1, "child" => 3, "ref_id" => 3, "obj_id" => 3, "parent" => 1],
42 4 => ["tree" => 1, "child" => 4, "ref_id" => 4, "obj_id" => 4, "parent" => 2],
43 5 => ["tree" => 1, "child" => 5, "ref_id" => 5, "obj_id" => 5, "parent" => 3],
44 6 => ["tree" => 1, "child" => 6, "ref_id" => 6, "obj_id" => 6, "parent" => 3],
45 7 => ["tree" => 1, "child" => 7, "ref_id" => 7, "obj_id" => 7, "parent" => 6],
46 8 => ["tree" => 1, "child" => 8, "ref_id" => 8, "obj_id" => 8, "parent" => 6],
47 9 => ["tree" => 1, "child" => 9, "ref_id" => 9, "obj_id" => 9, "parent" => 8],
48 ]
49 ]
50 ];
51
52 protected array $tree_data = [];
53
54 protected array $deleted_ref_ids = [];
55
56 protected function setUp(): void
57 {
58 parent::setUp();
59 }
60
61 public function loadTreeData(int $data_id): void
62 {
63 $this->tree_data = $this->test_tree_data[$data_id];
64 }
65
66 public function resetDeleteRefIds(): void
67 {
68 $this->deleted_ref_ids = [];
69 }
70
71 protected function addChilds($id, &$childs, $data): void
72 {
73 foreach ($data as $k => $c) {
74 if ($c["parent"] == $id) {
75 $childs[$k] = $c;
76 $this->addChilds($c["child"], $childs, $data);
77 }
78 }
79 }
80
81 public function createTreeInterfaceMock(int $tree_id): TreeInterface
82 {
83 $mock = $this->createMock(TreeInterface::class);
84
85 // isDeleted acts on all data entries of all trees
86 $mock->method('isDeleted')
87 ->willReturnCallback(function (int $child) {
88 foreach ($this->tree_data as $tree_id => $entries) {
89 if (isset($entries[$child])) {
90 return ($tree_id < 0);
91 }
92 }
93 return false;
94 });
95
96 // getNodeData acts only on tree $tree_id
97 $mock->method('getNodeData')
98 ->willReturnCallback(function (int $child) use ($tree_id) {
99 return $this->tree_data[$tree_id][$child];
100 });
101
102 $mock->method('useCache')
103 ->willReturnCallback(function (bool $a_use) {
104 });
105
106 // getSubTree acts only on tree $tree_id
107 $mock->method('getSubTree')
108 ->willReturnCallback(function (array $node) use ($tree_id) {
109 $childs[$node["child"]] = $node;
110 $data = $this->tree_data[$tree_id];
111 $this->addChilds($node['child'], $childs, $data);
112 return $childs;
113 });
114
115 // getDeletedTreeNodeIds acts on all data entries of all trees
116 $mock->method('getDeletedTreeNodeIds')
117 ->willReturnCallback(function (array $ids) use ($mock) {
118 $deleted_ids = [];
119 foreach ($ids as $id) {
120 if ($mock->isDeleted($id)) {
121 $deleted_ids[] = $id;
122 }
123 }
124 return $deleted_ids;
125 });
126
127 // getTree acts on all data
128 $mock->method('getTree')
129 ->willReturnCallback(function (int $tree_id) {
130 return $this->createTreeInterfaceMock($tree_id);
131 });
132
133 // getTrashTree acts on all data
134 $mock->method('getTrashTree')
135 ->willReturnCallback(function (int $child) use ($mock) {
136 foreach ($this->tree_data as $tree_id => $entries) {
137 if (isset($entries[$child]) && $tree_id < 0) {
138 return $mock->getTree($tree_id);
139 }
140 }
141 });
142
143 // Configure the deleteTree method
144 $mock->method('moveToTrash')
145 ->willReturnCallback(function (int $child) use ($mock, $tree_id) {
146 $moved = false;
147 foreach ($mock->getSubTree($mock->getNodeData($child)) as $subnode) {
148 if (isset($this->tree_data[$tree_id][$subnode["child"]])) {
149 unset($this->tree_data[$tree_id][$subnode["child"]]);
150 $subnode["tree"] = -$child;
151 $this->tree_data[-$child][$subnode["child"]] = $subnode;
152 $moved = true;
153 }
154 }
155 return $moved;
156 });
157
158 // Configure the deleteTree method
159 $mock->method('deleteTree')
160 ->willReturnCallback(function (array $node_data) use ($mock, $tree_id) {
161 foreach ($mock->getSubTree($node_data) as $subnode) {
162 unset($this->tree_data[$tree_id][$subnode["child"]]);
163 }
164 });
165
166 // Configure the getTrashedSubtrees method
167 $mock->method('getTrashedSubtrees')
168 ->willReturnCallback(function (int $ref_id) {
169 $tree_ids = [];
170 foreach ($this->tree_data as $tree_id => $entries) {
171 foreach ($entries as $entry) {
172 if ($entry["parent"] == $ref_id) {
173 if ($tree_id < 0 && $tree_id === -1 * $entry["child"]) {
174 $tree_ids[] = $tree_id;
175 }
176 }
177 }
178 }
179 return $tree_ids;
180 });
181
182 return $mock;
183 }
184
186 bool $access_given
188 // Create the mock object
189 $mock = $this->createMock(PermissionInterface::class);
190
191 // Configure the checkAccess method to return true or false based on operation and ref_id
192 $mock->method('checkAccess')
193 ->willReturnCallback(function (string $operation, int $ref_id) use ($access_given) {
194 return $access_given;
195 });
196
197 // Configure the revokePermission method
198 $mock->method('revokePermission')
199 ->willReturnCallback(function (int $ref_id) {
200 });
201
202 // Configure the getRefIdsWithoutDeletePermission method to return a filtered list of ids
203 $mock->method('getRefIdsWithoutDeletePermission')
204 ->willReturnCallback(function (array $ids) use ($access_given) {
205 if ($access_given) {
206 return [];
207 }
208 return $ids;
209 });
210
211 return $mock;
212 }
213
214 public function createObjectInterfaceMock(int $ref_id, array $failing_obj_ids = []): ObjectInterface
215 {
216 // Create the mock object
217 $mock = $this->createMock(ObjectInterface::class);
218
219 // Configure the getInstanceByRefId method to return the mock itself or null
220 $mock->method('getInstanceByRefId')
221 ->willReturnCallback(function (int $ref_id) use ($mock, $failing_obj_ids) {
222 return $this->createObjectInterfaceMock($ref_id, $failing_obj_ids);
223 });
224
225 // Configure the delete method
226 $mock->method('delete')
227 ->willReturnCallback(function () use ($ref_id, $failing_obj_ids) {
228 if (in_array($ref_id, $failing_obj_ids)) {
229 throw new \Exception("Failed to do something");
230 }
231 $this->deleted_ref_ids[] = $ref_id;
232 });
233
234 // Configure the getId method
235 $mock->method('getId')
236 ->willReturnCallback(function () use ($ref_id) {
237 return $ref_id;
238 });
239
240 // Configure the getType method
241 $mock->method('getType')
242 ->willReturn('tst');
243
244 // Configure the getTitle method
245 $mock->method('getTitle')
246 ->willReturn('Sample Object Title');
247
248 // Configure the getRefId method
249 $mock->method('getRefId')
250 ->willReturnCallback(function () use ($ref_id) {
251 return $ref_id;
252 });
253
254 return $mock;
255 }
256
257 protected function log(string $message): void
258 {
259 $log = false;
260 if ($log) {
261 echo $message . PHP_EOL;
262 }
263 }
264
266 {
267 // Create the mock object
268 $mock = $this->createMock(EventInterface::class);
269
270 // Configure the beforeMoveToTrash method
271 $mock->method('beforeMoveToTrash')
272 ->willReturnCallback(function (int $ref_id, array $subnodes) {
273 $this->log('beforeMoveToTrash: ' . $ref_id);
274 // No return value as the method is void
275 });
276
277 // Configure the afterMoveToTrash method
278 $mock->method('afterMoveToTrash')
279 ->willReturnCallback(function (int $ref_id, int $old_parent_ref_id) {
280 // No return value as the method is void
281 });
282
283 // Configure the beforeSubtreeRemoval method
284 $mock->method('beforeSubtreeRemoval')
285 ->willReturnCallback(function (int $obj_id) {
286 $this->log('beforeSubtreeRemoval: ' . $obj_id);
287 // No return value as the method is void
288 });
289
290 // Configure the beforeObjectRemoval method
291 $mock->method('beforeObjectRemoval')
292 ->willReturnCallback(function (int $obj_id, int $ref_id, string $type, string $title) {
293 $this->log('beforeObjectRemoval: ' . $obj_id);
294 // No return value as the method is void
295 });
296
297 // Configure the afterObjectRemoval method
298 $mock->method('afterObjectRemoval')
299 ->willReturnCallback(function (int $obj_id, int $ref_id, string $type, int $old_parent_ref_id) {
300 // No return value as the method is void
301 });
302
303 // Configure the afterTreeDeletion method
304 $mock->method('afterTreeDeletion')
305 ->willReturnCallback(function (int $tree_id, int $child) {
306 $this->log('afterTreeDeletion: ' . $tree_id . ", " . $child);
307 // No return value as the method is void
308 });
309
310 return $mock;
311 }
312
313 public function initDeletion(
314 ?TreeInterface $tree_mock = null,
315 bool $trash_enabled = true,
316 bool $access_given = true,
317 array $failing_obj_ids = []
318 ): Deletion {
319 return new Deletion(
320 $tree_mock,
321 $this->createPermissionInterfaceMock($access_given),
322 $this->createEventInterfaceMock(),
323 $this->createObjectInterfaceMock(0, $failing_obj_ids),
324 $trash_enabled
325 );
326 }
327 protected function tearDown(): void
328 {
329 }
330
331 public function testTreeMockTest(): void
332 {
333 $this->loadTreeData(1);
334 $tree_mock = $this->createTreeInterfaceMock(1);
335
336 $node1 = $tree_mock->getNodeData(1);
337 $this->assertEquals(0, $node1["parent"]);
338
339 $tree_mock->moveToTrash(2);
340 $this->assertEquals(true, $tree_mock->isDeleted(2));
341 }
342
343 public function testDeletionInstantiation(): void
344 {
345 $this->loadTreeData(1);
346 $this->resetDeleteRefIds();
347 $tree_mock = $this->createTreeInterfaceMock(1);
348 $deletion = $this->initDeletion(
349 $tree_mock,
350 true,
351 true
352 );
353
354 static::assertInstanceOf(Deletion::class, $deletion);
355 }
356
365 public function testDeletionDeleteWithTrash(): void
366 {
367 $this->loadTreeData(1);
368 $this->resetDeleteRefIds();
369 $tree_mock = $this->createTreeInterfaceMock(1);
370 $deletion = $this->initDeletion(
371 $tree_mock,
372 true,
373 true
374 );
375
376 $deletion->deleteObjectsByRefIds([2]);
377 $this->assertEquals(true, $tree_mock->isDeleted(2));
378
379 $this->assertEquals([-2], $tree_mock->getTrashedSubtrees(1));
380
381 // nothing has been finally deleted
382 $this->assertEquals([], $this->deleted_ref_ids);
383 }
384
395 {
396 $this->loadTreeData(1);
397 $this->resetDeleteRefIds();
398 $tree_mock = $this->createTreeInterfaceMock(1);
399 $deletion = $this->initDeletion(
400 $tree_mock,
401 true,
402 true
403 );
404
405 $deletion->deleteObjectsByRefIds([2]);
406 $deletion->deleteObjectsByRefIds([3]);
407 $this->assertEquals(true, $tree_mock->isDeleted(2));
408 $this->assertEquals(true, $tree_mock->isDeleted(3));
409
410 $this->assertEquals([-2, -3], $tree_mock->getTrashedSubtrees(1));
411
412 // nothing has been finally deleted
413 $this->assertEquals([], $this->deleted_ref_ids);
414 }
415
424 public function testDeletionDeleteWithoutTrash(): void
425 {
426 $this->loadTreeData(1);
427 $this->resetDeleteRefIds();
428 $tree_mock = $this->createTreeInterfaceMock(1);
429 $deletion = $this->initDeletion(
430 $tree_mock,
431 false,
432 true
433 );
434
435 // delete tree 2
436 $deletion->deleteObjectsByRefIds([2]);
437
438 // tree is not in trash
439 $this->assertEquals(false, $tree_mock->isDeleted(2));
440
441 // no trashed subtrees
442 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
443
444 // 2 has been deleted
445 $this->assertEquals([2,4], $this->deleted_ref_ids);
446 }
447
458 {
459 $this->loadTreeData(1);
460 $this->resetDeleteRefIds();
461 $tree_mock = $this->createTreeInterfaceMock(1);
462 $deletion = $this->initDeletion(
463 $tree_mock,
464 true,
465 true
466 );
467
468 // delete tree 2
469 $deletion->deleteObjectsByRefIds([2]);
470
471 $deletion->removeObjectsFromSystemByRefIds([2]);
472
473 // 2 is not in trash
474 $this->assertEquals(false, $tree_mock->isDeleted(2));
475
476 // no left trashed subtrees
477 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
478
479 // 2,4 have been deleted
480 $this->assertEquals([2,4], $this->deleted_ref_ids);
481 }
482
492 {
493 $this->log(PHP_EOL . "---testDeletionDeleteRemoveFromSystemMultiple");
494 $this->loadTreeData(1);
495 $this->resetDeleteRefIds();
496 $tree_mock = $this->createTreeInterfaceMock(1);
497 $deletion = $this->initDeletion(
498 $tree_mock,
499 true,
500 true
501 );
502
503 // delete tree 2
504 $this->log("---call: deleteObjectsByRefIds 6");
505 $deletion->deleteObjectsByRefIds([6]);
506 $this->log("---call: deleteObjectsByRefIds 3");
507 $deletion->deleteObjectsByRefIds([3]);
508
509 $this->log("---call: removeObjectsFromSystemByRefIds 3");
510 $deletion->removeObjectsFromSystemByRefIds([3]);
511
512 // 3,5,6,7,8 are not in trash
513 $this->assertEquals(false, $tree_mock->isDeleted(3));
514 $this->assertEquals(false, $tree_mock->isDeleted(5));
515 $this->assertEquals(false, $tree_mock->isDeleted(6));
516 $this->assertEquals(false, $tree_mock->isDeleted(7));
517 $this->assertEquals(false, $tree_mock->isDeleted(8));
518 $this->assertEquals(false, $tree_mock->isDeleted(9));
519
520 // no left trashed subtrees
521 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
522 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
523
524 // 3,5,6,7,8 have been deleted
525 $this->assertEqualsCanonicalizing([3,5,6,7,8,9], $this->deleted_ref_ids);
526 $this->log("---END---testDeletionDeleteRemoveFromSystemMultiple");
527 }
528
538 {
539 $this->log(PHP_EOL . "---testDeletionDeleteRemoveFromSystemMultiple");
540 $this->loadTreeData(1);
541 $this->resetDeleteRefIds();
542 $tree_mock = $this->createTreeInterfaceMock(1);
543 $deletion = $this->initDeletion(
544 $tree_mock,
545 true,
546 true
547 );
548
549 // delete tree 2
550 $this->log("---call: deleteObjectsByRefIds 8");
551 $deletion->deleteObjectsByRefIds([8]);
552 $this->log("---call: deleteObjectsByRefIds 3");
553 $deletion->deleteObjectsByRefIds([3]);
554
555 $this->log("---call: removeObjectsFromSystemByRefIds 3");
556 $deletion->removeObjectsFromSystemByRefIds([3]);
557
558 // 3,5,6,7,8 are not in trash
559 $this->assertEquals(false, $tree_mock->isDeleted(3));
560 $this->assertEquals(false, $tree_mock->isDeleted(5));
561 $this->assertEquals(false, $tree_mock->isDeleted(6));
562 $this->assertEquals(false, $tree_mock->isDeleted(7));
563 $this->assertEquals(false, $tree_mock->isDeleted(8));
564 $this->assertEquals(false, $tree_mock->isDeleted(9));
565
566 // no left trashed subtrees
567 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
568 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
569
570 // 3,5,6,7,8,9 have been deleted
571 $this->assertEqualsCanonicalizing([3,5,6,7,8,9], $this->deleted_ref_ids);
572 $this->log("---END---testDeletionDeleteRemoveFromSystemMultiple");
573 }
574
585 {
586 $this->log(PHP_EOL . "---testDeletionRemoveFromSystemTrashInTrash");
587 $this->loadTreeData(1);
588 $this->resetDeleteRefIds();
589 $tree_mock = $this->createTreeInterfaceMock(1);
590 $deletion = $this->initDeletion(
591 $tree_mock,
592 true,
593 true
594 );
595
596 $this->log("---call: deleteObjectsByRefIds 9");
597 $deletion->deleteObjectsByRefIds([9]);
598 $this->log("---call: deleteObjectsByRefIds 8");
599 $deletion->deleteObjectsByRefIds([8]);
600 $this->log("---call: deleteObjectsByRefIds 3");
601 $deletion->deleteObjectsByRefIds([3]);
602
603 $this->log("---call: removeObjectsFromSystemByRefIds 3");
604 $deletion->removeObjectsFromSystemByRefIds([3]);
605
606 // 3,5,6,7,8 are not in trash
607 $this->assertEquals(false, $tree_mock->isDeleted(3));
608 $this->assertEquals(false, $tree_mock->isDeleted(5));
609 $this->assertEquals(false, $tree_mock->isDeleted(6));
610 $this->assertEquals(false, $tree_mock->isDeleted(7));
611 $this->assertEquals(false, $tree_mock->isDeleted(8));
612 $this->assertEquals(false, $tree_mock->isDeleted(9));
613
614 // no left trashed subtrees
615 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
616 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
617
618 // 3,5,6,7,8,9 have been deleted
619 $this->assertEqualsCanonicalizing([3,5,6,7,8,9], $this->deleted_ref_ids);
620 $this->log("---END---testDeletionRemoveFromSystemTrashInTrash");
621 }
622
632 {
633 $this->log(PHP_EOL . "---testDeletionRemoveFromSystemFailingObject");
634 $this->loadTreeData(1);
635 $this->resetDeleteRefIds();
636 $tree_mock = $this->createTreeInterfaceMock(1);
637 $deletion = $this->initDeletion(
638 $tree_mock,
639 true,
640 true,
641 [8]
642 );
643
644 $this->log("---call: deleteObjectsByRefIds 9");
645 $deletion->deleteObjectsByRefIds([9]);
646 $this->log("---call: deleteObjectsByRefIds 8");
647 $deletion->deleteObjectsByRefIds([8]);
648 $this->log("---call: deleteObjectsByRefIds 3");
649 $deletion->deleteObjectsByRefIds([3]);
650
651 $this->log("---call: removeObjectsFromSystemByRefIds 3");
652 $deletion->removeObjectsFromSystemByRefIds([3]);
653
654 // 3,5,6,7,8 are not in trash
655 $this->assertEquals(false, $tree_mock->isDeleted(3));
656 $this->assertEquals(false, $tree_mock->isDeleted(5));
657 $this->assertEquals(false, $tree_mock->isDeleted(6));
658 $this->assertEquals(false, $tree_mock->isDeleted(7));
659 $this->assertEquals(false, $tree_mock->isDeleted(8));
660 $this->assertEquals(false, $tree_mock->isDeleted(9));
661
662 // no left trashed subtrees
663 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
664 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
665
666 // 3,5,6,7,8,9 have been deleted
667 $this->assertEqualsCanonicalizing([3,5,6,7,9], $this->deleted_ref_ids);
668 $this->log("---END---testDeletionRemoveFromSystemFailingObject");
669 }
670
682 {
683 $this->log(PHP_EOL . "---testDeletionRemoveFromSystemTrashInTrashInTrash");
684 $this->loadTreeData(1);
685 $this->resetDeleteRefIds();
686 $tree_mock = $this->createTreeInterfaceMock(1);
687 $deletion = $this->initDeletion(
688 $tree_mock,
689 true,
690 true,
691 [8]
692 );
693
694 $this->log("---call: deleteObjectsByRefIds 9");
695 $deletion->deleteObjectsByRefIds([9]);
696 $this->log("---call: deleteObjectsByRefIds 8");
697 $deletion->deleteObjectsByRefIds([8]);
698 $this->log("---call: deleteObjectsByRefIds 6");
699 $deletion->deleteObjectsByRefIds([6]);
700 $this->log("---call: deleteObjectsByRefIds 3");
701 $deletion->deleteObjectsByRefIds([3]);
702
703 $this->log("---call: removeObjectsFromSystemByRefIds 3");
704 $deletion->removeObjectsFromSystemByRefIds([3]);
705
706 // 3,5,6,7,8 are not in trash
707 $this->assertEquals(false, $tree_mock->isDeleted(3));
708 $this->assertEquals(false, $tree_mock->isDeleted(5));
709 $this->assertEquals(false, $tree_mock->isDeleted(6));
710 $this->assertEquals(false, $tree_mock->isDeleted(7));
711 $this->assertEquals(false, $tree_mock->isDeleted(8));
712 $this->assertEquals(false, $tree_mock->isDeleted(9));
713
714 // no left trashed subtrees
715 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
716 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
717
718 // 3,5,6,7,8,9 have been deleted
719 $this->assertEqualsCanonicalizing([3,5,6,7,9], $this->deleted_ref_ids);
720 $this->log("---END---testDeletionRemoveFromSystemTrashInTrashInTrash");
721 }
722
723 public function testDeletionNoDeletePermission(): void
724 {
725 $this->log(PHP_EOL . "---testDeletionNoDeletePermission");
726 $this->loadTreeData(1);
727 $this->resetDeleteRefIds();
728 $tree_mock = $this->createTreeInterfaceMock(1);
729 $deletion = $this->initDeletion(
730 $tree_mock,
731 true,
732 false,
733 [8]
734 );
735
736 $this->log("---call: deleteObjectsByRefIds 9");
737 $this->expectException(MissingPermissionException::class);
738 $deletion->deleteObjectsByRefIds([9]);
739
740 // 9 not in trash
741 $this->assertEquals(false, $tree_mock->isDeleted(9));
742
743 // no trashed subtrees
744 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
745 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
746
747 // nothing deleted
748 $this->assertEqualsCanonicalizing([], $this->deleted_ref_ids);
749 $this->log("---END---testDeletionNoDeletePermission");
750 }
751
762 {
763 $this->log(PHP_EOL . "---testDeletionTrashDisabledTrashInTrashInTrash");
764 $this->loadTreeData(1);
765 $this->resetDeleteRefIds();
766 $tree_mock = $this->createTreeInterfaceMock(1);
767 $deletion = $this->initDeletion(
768 $tree_mock,
769 false,
770 true,
771 []
772 );
773
774 $this->log("---call: deleteObjectsByRefIds 9");
775 $deletion->deleteObjectsByRefIds([9]);
776 $this->log("---call: deleteObjectsByRefIds 8");
777 $deletion->deleteObjectsByRefIds([8]);
778 $this->log("---call: deleteObjectsByRefIds 6");
779 $deletion->deleteObjectsByRefIds([6]);
780 $this->log("---call: deleteObjectsByRefIds 3");
781 $deletion->deleteObjectsByRefIds([3]);
782
783 // 3,5,6,7,8,9 are not in trash
784 $this->assertEquals(false, $tree_mock->isDeleted(3));
785 $this->assertEquals(false, $tree_mock->isDeleted(5));
786 $this->assertEquals(false, $tree_mock->isDeleted(6));
787 $this->assertEquals(false, $tree_mock->isDeleted(7));
788 $this->assertEquals(false, $tree_mock->isDeleted(8));
789 $this->assertEquals(false, $tree_mock->isDeleted(9));
790
791 // no left trashed subtrees
792 $this->assertEquals([], $tree_mock->getTrashedSubtrees(1));
793 $this->assertEquals([], $tree_mock->getTrashedSubtrees(2));
794
795 // 3,5,6,7,8,9 have been deleted
796 $this->assertEqualsCanonicalizing([3,5,6,7,8,9], $this->deleted_ref_ids);
797 $this->log("---END---testDeletionTrashDisabledTrashInTrashInTrash");
798 }
799
800}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
createObjectInterfaceMock(int $ref_id, array $failing_obj_ids=[])
createPermissionInterfaceMock(bool $access_given)
initDeletion(?TreeInterface $tree_mock=null, bool $trash_enabled=true, bool $access_given=true, array $failing_obj_ids=[])
$c
Definition: deliver.php:25
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
$log
Definition: ltiresult.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$message
Definition: xapiexit.php:31