ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
GloPresentationGUIRequestTest.php
Go to the documentation of this file.
1 <?php
2 
4 
10 class GloPresentationGUIRequestTest extends TestCase
11 {
12  protected function getRequest(array $get, array $post): \ILIAS\Glossary\Presentation\PresentationGUIRequest
13  {
14  $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
15  $lng_mock = $this->createMock(ilLanguage::class);
16  $data = new \ILIAS\Data\Factory();
17  $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
18  return new \ILIAS\Glossary\Presentation\PresentationGUIRequest(
19  $http_mock,
20  $refinery,
21  $get,
22  $post
23  );
24  }
25 
26  public function testRefId(): void
27  {
28  $request = $this->getRequest(
29  [
30  "ref_id" => "5"
31  ],
32  []
33  );
34 
35  $this->assertEquals(
36  5,
37  $request->getRefId()
38  );
39  }
40 
41  public function testLetter(): void
42  {
43  $request = $this->getRequest(
44  [
45  "letter" => "a"
46  ],
47  []
48  );
49 
50  $this->assertEquals(
51  "a",
52  $request->getLetter()
53  );
54  }
55 
56  public function testTermId(): void
57  {
58  $request = $this->getRequest(
59  [
60  "term_id" => "14"
61  ],
62  []
63  );
64 
65  $this->assertEquals(
66  14,
67  $request->getTermId()
68  );
69  }
70 }
Interface Observer Contains several chained tasks and infos about them.
$post
Definition: ltitoken.php:46