ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RootStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
28class RootStandardGUIRequestTest extends TestCase
29{
30 protected function tearDown(): void
31 {
32 }
33
34 protected function getRequest(array $get, array $post): \ILIAS\RootFolder\StandardGUIRequest
35 {
36 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
37 $lng_mock = $this->createMock(ilLanguage::class);
38 $data = new \ILIAS\Data\Factory();
39 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
40 return new \ILIAS\RootFolder\StandardGUIRequest(
41 $http_mock,
43 $get,
44 $post
45 );
46 }
47
51 public function testRefId(): void
52 {
53 $request = $this->getRequest(
54 [
55 "ref_id" => "5"
56 ],
57 []
58 );
59
60 $this->assertEquals(
61 5,
62 $request->getRefId()
63 );
64 }
65
69 public function testNoRefId(): void
70 {
71 $request = $this->getRequest(
72 [
73 ],
74 []
75 );
76
77 $this->assertEquals(
78 0,
79 $request->getRefId()
80 );
81 }
82
86 public function testBaseClass(): void
87 {
88 $request = $this->getRequest(
89 [
90 "baseClass" => "myClass"
91 ],
92 []
93 );
94
95 $this->assertEquals(
96 "myClass",
97 $request->getBaseClass()
98 );
99 }
100}
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:46
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.