ILIAS  release_8 Revision v8.24
BlogStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
3use PHPUnit\Framework\TestCase;
4
8class BlogStandardGUIRequestTest extends TestCase
9{
10 //protected $backupGlobals = false;
11
12 protected function setUp(): void
13 {
14 parent::setUp();
15 }
16
17 protected function tearDown(): void
18 {
19 }
20
21 protected function getRequest(array $get, array $post): \ILIAS\Blog\StandardGUIRequest
22 {
23 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
24 $lng_mock = $this->createMock(ilLanguage::class);
25 $data = new \ILIAS\Data\Factory();
26 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
27 return new \ILIAS\Blog\StandardGUIRequest(
28 $http_mock,
30 $get,
31 $post
32 );
33 }
34
35 public function testRefId()
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
50 public function testBlogPage()
51 {
52 $request = $this->getRequest(
53 [
54 "blpg" => "6"
55 ],
56 []
57 );
58
59 $this->assertEquals(
60 6,
61 $request->getBlogPage()
62 );
63 }
64
65 public function testObjIds()
66 {
67 $request = $this->getRequest(
68 [
69 ],
70 [
71 "obj_id" => ["3", "7"]
72 ]
73 );
74
75 $this->assertEquals(
76 [3,7],
77 $request->getObjIds()
78 );
79 }
80
81 public function testIds()
82 {
83 $request = $this->getRequest(
84 [
85 ],
86 [
87 "id" => ["12", "17"]
88 ]
89 );
90
91 $this->assertEquals(
92 [12,17],
93 $request->getIds()
94 );
95 }
96
97 public function testUserLogin()
98 {
99 $request = $this->getRequest(
100 [
101 "user_login" => "my_login"
102 ],
103 []
104 );
105
106 $this->assertEquals(
107 "my_login",
108 $request->getUserLogin()
109 );
110 }
111
112 public function testKeyword()
113 {
114 $request = $this->getRequest(
115 [
116 "kwd" => "my_keyw"
117 ],
118 []
119 );
120
121 $this->assertEquals(
122 "my_keyw",
123 $request->getKeyword()
124 );
125 }
126}
getRequest(array $get, array $post)
$post
Definition: ltitoken.php:49
Refinery Factory $refinery
Class ChatMainBarProvider \MainMenu\Provider.