ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
BlogStandardGUIRequestTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
10 class BlogStandardGUIRequestTest extends TestCase
11 {
12  //protected $backupGlobals = false;
13 
14  protected function tearDown(): void
15  {
16  }
17 
18  protected function getRequest(array $get, array $post): \ILIAS\Blog\StandardGUIRequest
19  {
20  $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
21  $lng_mock = $this->createMock(ilLanguage::class);
22  $data = new \ILIAS\Data\Factory();
23  $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
24  return new \ILIAS\Blog\StandardGUIRequest(
25  $http_mock,
26  $refinery,
27  $get,
28  $post
29  );
30  }
31 
32  public function testRefId()
33  {
34  $request = $this->getRequest(
35  [
36  "ref_id" => "5"
37  ],
38  []
39  );
40 
41  $this->assertEquals(
42  5,
43  $request->getRefId()
44  );
45  }
46 
47  public function testBlogPage()
48  {
49  $request = $this->getRequest(
50  [
51  "blpg" => "6"
52  ],
53  []
54  );
55 
56  $this->assertEquals(
57  6,
58  $request->getBlogPage()
59  );
60  }
61 
62  public function testObjIds()
63  {
64  $request = $this->getRequest(
65  [
66  ],
67  [
68  "obj_id" => ["3", "7"]
69  ]
70  );
71 
72  $this->assertEquals(
73  [3,7],
74  $request->getObjIds()
75  );
76  }
77 
78  public function testIds()
79  {
80  $request = $this->getRequest(
81  [
82  ],
83  [
84  "id" => ["12", "17"]
85  ]
86  );
87 
88  $this->assertEquals(
89  [12,17],
90  $request->getIds()
91  );
92  }
93 
94  public function testUserLogin()
95  {
96  $request = $this->getRequest(
97  [
98  "user_login" => "my_login"
99  ],
100  []
101  );
102 
103  $this->assertEquals(
104  "my_login",
105  $request->getUserLogin()
106  );
107  }
108 
109  public function testKeyword()
110  {
111  $request = $this->getRequest(
112  [
113  "kwd" => "my_keyw"
114  ],
115  []
116  );
117 
118  $this->assertEquals(
119  "my_keyw",
120  $request->getKeyword()
121  );
122  }
123 }
Interface Observer Contains several chained tasks and infos about them.
$post
Definition: ltitoken.php:46
getRequest(array $get, array $post)