ILIAS  release_8 Revision v8.24
HTMLLearningModuleStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
3use PHPUnit\Framework\TestCase;
4
9{
10 protected function tearDown(): void
11 {
12 }
13
14 protected function getRequest(array $get, array $post): \ILIAS\HTMLLearningModule\StandardGUIRequest
15 {
16 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
17 $lng_mock = $this->createMock(ilLanguage::class);
18 $data = new \ILIAS\Data\Factory();
19 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
20 return new \ILIAS\HTMLLearningModule\StandardGUIRequest(
21 $http_mock,
23 $get,
24 $post
25 );
26 }
27
28 public function testRefId(): void
29 {
30 $request = $this->getRequest(
31 [
32 "ref_id" => "66"
33 ],
34 [
35 ]
36 );
37
38 $this->assertEquals(
39 66,
40 $request->getRefId()
41 );
42 }
43
44 public function testUserId(): void
45 {
46 $request = $this->getRequest(
47 [
48 "user_id" => "4"
49 ],
50 [
51 ]
52 );
53
54 $this->assertEquals(
55 4,
56 $request->getUserId()
57 );
58 }
59}
$post
Definition: ltitoken.php:49
Refinery Factory $refinery
Class ChatMainBarProvider \MainMenu\Provider.