ILIAS  release_8 Revision v8.24
LMEditingGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
3use PHPUnit\Framework\TestCase;
4
10class LMEditingGUIRequestTest extends TestCase
11{
12 protected function tearDown(): void
13 {
14 }
15
16 protected function getRequest(array $get, array $post): \ILIAS\LearningModule\Editing\EditingGUIRequest
17 {
18 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
19 $lng_mock = $this->createMock(ilLanguage::class);
20 $data = new \ILIAS\Data\Factory();
21 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
22 return new \ILIAS\LearningModule\Editing\EditingGUIRequest(
23 $http_mock,
25 $get,
26 $post
27 );
28 }
29
30 public function testRefId(): void
31 {
32 $request = $this->getRequest(
33 [
34 "ref_id" => "5"
35 ],
36 []
37 );
38
39 $this->assertEquals(
40 5,
41 $request->getRefId()
42 );
43 }
44
45 public function testFirstChild(): void
46 {
47 $request = $this->getRequest(
48 [
49 "first_child" => "1"
50 ],
51 []
52 );
53
54 $this->assertEquals(
55 true,
56 $request->getFirstChild()
57 );
58 }
59
60 public function testMulti(): void
61 {
62 $request = $this->getRequest(
63 [
64 "multi" => "1"
65 ],
66 []
67 );
68
69 $this->assertEquals(
70 1,
71 $request->getMulti()
72 );
73 }
74
75 public function testNodeId(): void
76 {
77 $request = $this->getRequest(
78 [
79 "node_id" => "5"
80 ],
81 []
82 );
83
84 $this->assertEquals(
85 5,
86 $request->getNodeId()
87 );
88 }
89
90 public function testTitles(): void
91 {
92 $request = $this->getRequest(
93 [
94 "title" => ["1" => "test", "2" => "titles"]
95 ],
96 []
97 );
98
99 $this->assertEquals(
100 ["1" => "test", "2" => "titles"],
101 $request->getTitles()
102 );
103 }
104
105 public function testIds(): void
106 {
107 $request = $this->getRequest(
108 [
109 "id" => ["4", "6"]
110 ],
111 []
112 );
113
114 $this->assertEquals(
115 [4, 6],
116 $request->getIds()
117 );
118 }
119}
Test learning module editing request.
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:49
Refinery Factory $refinery
Class ChatMainBarProvider \MainMenu\Provider.