ILIAS  release_8 Revision v8.23
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 testDefinitionId(): void
42  {
43  $request = $this->getRequest(
44  [
45  "def" => "7"
46  ],
47  []
48  );
49 
50  $this->assertEquals(
51  7,
52  $request->getDefinitionId()
53  );
54  }
55 
56  public function testLetter(): void
57  {
58  $request = $this->getRequest(
59  [
60  "letter" => "a"
61  ],
62  []
63  );
64 
65  $this->assertEquals(
66  "a",
67  $request->getLetter()
68  );
69  }
70 
71  public function testTermId(): void
72  {
73  $request = $this->getRequest(
74  [
75  "term_id" => "14"
76  ],
77  []
78  );
79 
80  $this->assertEquals(
81  14,
82  $request->getTermId()
83  );
84  }
85 
86  public function test(): void
87  {
88  $request = $this->getRequest(
89  [
90  "type" => "xml"
91  ],
92  []
93  );
94 
95  $this->assertEquals(
96  "xml",
97  $request->getExportType()
98  );
99  }
100 }
Class ChatMainBarProvider .
$post
Definition: ltitoken.php:49
Refinery Factory $refinery