ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
FoldStandardGUIRequestTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
12 class FoldStandardGUIRequestTest extends TestCase
13 {
14  protected function tearDown(): void
15  {
16  }
17 
18  protected function getRequest(array $get, array $post): \ILIAS\Folder\StandardGUIRequest
19  {
20  $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
21  $lng_mock = $this->createMock(ilLanguage::class);
22  $data = new \ILIAS\Data\Factory();
23  $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
24  return new \ILIAS\Folder\StandardGUIRequest(
25  $http_mock,
26  $refinery,
27  $get,
28  $post
29  );
30  }
31 
35  public function testRefId(): void
36  {
37  $request = $this->getRequest(
38  [
39  "ref_id" => "5"
40  ],
41  []
42  );
43 
44  $this->assertEquals(
45  5,
46  $request->getRefId()
47  );
48  }
49 
53  public function testNoRefId(): void
54  {
55  $request = $this->getRequest(
56  [
57  ],
58  []
59  );
60 
61  $this->assertEquals(
62  0,
63  $request->getRefId()
64  );
65  }
66 
70  public function testBaseClass(): void
71  {
72  $request = $this->getRequest(
73  [
74  "baseClass" => "myClass"
75  ],
76  []
77  );
78 
79  $this->assertEquals(
80  "myClass",
81  $request->getBaseClass()
82  );
83  }
84 
88  public function testCmdClass(): void
89  {
90  $request = $this->getRequest(
91  [
92  "cmdClass" => "myClass"
93  ],
94  []
95  );
96 
97  $this->assertEquals(
98  "myClass",
99  $request->getCmdClass()
100  );
101  }
102 
106  public function testUserId(): void
107  {
108  $request = $this->getRequest(
109  [
110  "user_id" => "4"
111  ],
112  []
113  );
114 
115  $this->assertEquals(
116  4,
117  $request->getUserId()
118  );
119  }
120 }
Class ChatMainBarProvider .
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:49
Refinery Factory $refinery