ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
HTMLLearningModuleStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
20
25{
26 protected function tearDown(): void
27 {
28 }
29
30 protected function getRequest(array $get, array $post): \ILIAS\HTMLLearningModule\StandardGUIRequest
31 {
32 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
33 $lng_mock = $this->createMock(ilLanguage::class);
34 $data = new \ILIAS\Data\Factory();
35 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
36 return new \ILIAS\HTMLLearningModule\StandardGUIRequest(
37 $http_mock,
39 $get,
40 $post
41 );
42 }
43
44 public function testRefId(): void
45 {
46 $request = $this->getRequest(
47 [
48 "ref_id" => "66"
49 ],
50 [
51 ]
52 );
53
54 $this->assertEquals(
55 66,
56 $request->getRefId()
57 );
58 }
59
60 public function testUserId(): void
61 {
62 $request = $this->getRequest(
63 [
64 "user_id" => "4"
65 ],
66 [
67 ]
68 );
69
70 $this->assertEquals(
71 4,
72 $request->getUserId()
73 );
74 }
75}
$post
Definition: ltitoken.php:46
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.