ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
HelpStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
20
26class HelpStandardGUIRequestTest extends TestCase
27{
28 protected function tearDown(): void
29 {
30 }
31
32 protected function getRequest(array $get, array $post): \ILIAS\Help\StandardGUIRequest
33 {
34 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
35 $lng_mock = $this->createMock(ilLanguage::class);
36 $data = new \ILIAS\Data\Factory();
37 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
38 return new \ILIAS\Help\StandardGUIRequest(
39 $http_mock,
41 $get,
42 $post
43 );
44 }
45
46 public function testRefId(): void
47 {
48 $request = $this->getRequest(
49 [
50 "ref_id" => "5"
51 ],
52 []
53 );
54
55 $this->assertEquals(
56 5,
57 $request->getRefId()
58 );
59 }
60
61 public function testHelpModuleId(): void
62 {
63 $request = $this->getRequest(
64 [
65 "hm_id" => "7"
66 ],
67 []
68 );
69
70 $this->assertEquals(
71 7,
72 $request->getHelpModuleId()
73 );
74 }
75
76 public function testTerm(): void
77 {
78 $request = $this->getRequest(
79 [
80 "term" => "test"
81 ],
82 []
83 );
84
85 $this->assertEquals(
86 "test",
87 $request->getTerm()
88 );
89 }
90
91 public function testIds(): void
92 {
93 $request = $this->getRequest(
94 [
95 ],
96 [
97 "id" => [4, 6, 7]
98 ]
99 );
100
101 $this->assertEquals(
102 [4, 6, 7],
103 $request->getIds()
104 );
105 }
106
107 public function testHelpScreenId(): void
108 {
109 $request = $this->getRequest(
110 [
111 "help_screen_id" => "foo"
112 ],
113 [
114
115 ]
116 );
117
118 $this->assertEquals(
119 "foo",
120 $request->getHelpScreenId()
121 );
122 }
123}
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:46
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.