ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
BlogStandardGUIRequestTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 {
28  //protected $backupGlobals = false;
29 
30  protected function tearDown(): void
31  {
32  }
33 
34  protected function getRequest(array $get, array $post): \ILIAS\Blog\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\Blog\StandardGUIRequest(
41  $http_mock,
42  $refinery,
43  $get,
44  $post
45  );
46  }
47 
48  public function testRefId()
49  {
50  $request = $this->getRequest(
51  [
52  "ref_id" => "5"
53  ],
54  []
55  );
56 
57  $this->assertEquals(
58  5,
59  $request->getRefId()
60  );
61  }
62 
63  public function testBlogPage()
64  {
65  $request = $this->getRequest(
66  [
67  "blpg" => "6"
68  ],
69  []
70  );
71 
72  $this->assertEquals(
73  6,
74  $request->getBlogPage()
75  );
76  }
77 
78  public function testObjIds()
79  {
80  $request = $this->getRequest(
81  [
82  ],
83  [
84  "obj_id" => ["3", "7"]
85  ]
86  );
87 
88  $this->assertEquals(
89  [3,7],
90  $request->getObjIds()
91  );
92  }
93 
94  public function testIds()
95  {
96  $request = $this->getRequest(
97  [
98  ],
99  [
100  "id" => ["12", "17"]
101  ]
102  );
103 
104  $this->assertEquals(
105  [12,17],
106  $request->getIds()
107  );
108  }
109 
110  public function testUserLogin()
111  {
112  $request = $this->getRequest(
113  [
114  "user_login" => "my_login"
115  ],
116  []
117  );
118 
119  $this->assertEquals(
120  "my_login",
121  $request->getUserLogin()
122  );
123  }
124 
125  public function testKeyword()
126  {
127  $request = $this->getRequest(
128  [
129  "kwd" => "my_keyw"
130  ],
131  []
132  );
133 
134  $this->assertEquals(
135  "my_keyw",
136  $request->getKeyword()
137  );
138  }
139 }
Interface Observer Contains several chained tasks and infos about them.
$post
Definition: ltitoken.php:46
getRequest(array $get, array $post)