ILIAS  release_8 Revision v8.24
ContentStyleStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5use PHPUnit\Framework\TestCase;
8
15{
16 protected function tearDown(): void
17 {
18 }
19
20 protected function getRequest(array $get, array $post): StandardGUIRequest
21 {
22 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
23 $lng_mock = $this->createMock(ilLanguage::class);
24 $data = new Factory();
25 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
26 return new StandardGUIRequest(
27 $http_mock,
29 $get,
30 $post
31 );
32 }
33
34 public function testRefId(): void
35 {
36 $request = $this->getRequest(
37 [
38 "ref_id" => "5"
39 ],
40 []
41 );
42
43 $this->assertEquals(
44 5,
45 $request->getRefId()
46 );
47 }
48
49
50 public function testTemplateId(): void
51 {
52 $request = $this->getRequest(
53 [
54 "t_id" => "7"
55 ],
56 []
57 );
58
59 $this->assertEquals(
60 7,
61 $request->getTemplateId()
62 );
63 }
64
65 public function testCharacteristics(): void
66 {
67 $request = $this->getRequest(
68 [
69 ],
70 [
71 "char" => [
72 "Foo",
73 "Bar"
74 ]
75 ]
76 );
77
78 $this->assertEquals(
79 ["Foo", "Bar"],
80 $request->getCharacteristics()
81 );
82 }
83}
Builds data types.
Definition: Factory.php:21
$post
Definition: ltitoken.php:49
Refinery Factory $refinery
Class ChatMainBarProvider \MainMenu\Provider.