ILIAS  release_8 Revision v8.24
HelpStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
3use PHPUnit\Framework\TestCase;
4
10class HelpStandardGUIRequestTest extends TestCase
11{
12 protected function tearDown(): void
13 {
14 }
15
16 protected function getRequest(array $get, array $post): \ILIAS\Help\StandardGUIRequest
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\Help\StandardGUIRequest(
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 testHelpModuleId(): void
46 {
47 $request = $this->getRequest(
48 [
49 "hm_id" => "7"
50 ],
51 []
52 );
53
54 $this->assertEquals(
55 7,
56 $request->getHelpModuleId()
57 );
58 }
59
60 public function testTerm(): void
61 {
62 $request = $this->getRequest(
63 [
64 "term" => "test"
65 ],
66 []
67 );
68
69 $this->assertEquals(
70 "test",
71 $request->getTerm()
72 );
73 }
74
75 public function testIds(): void
76 {
77 $request = $this->getRequest(
78 [
79 ],
80 [
81 "id" => [4, 6, 7]
82 ]
83 );
84
85 $this->assertEquals(
86 [4, 6, 7],
87 $request->getIds()
88 );
89 }
90
91 public function testHelpScreenId(): void
92 {
93 $request = $this->getRequest(
94 [
95 "help_screen_id" => "foo"
96 ],
97 [
98
99 ]
100 );
101
102 $this->assertEquals(
103 "foo",
104 $request->getHelpScreenId()
105 );
106 }
107}
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:49
Refinery Factory $refinery
Class ChatMainBarProvider \MainMenu\Provider.