ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BookManStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
19use PHPUnit\Framework\TestCase;
20
24class BookManStandardGUIRequestTest extends TestCase
25{
26 //protected $backupGlobals = false;
27
28 protected function tearDown(): void
29 {
30 }
31
32 protected function getRequest(array $get, array $post): \ILIAS\BookingManager\StandardGUIRequest
33 {
34 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
35 $lng_mock = $this->createMock(ilLanguage::class);
36 $data = new \ILIAS\Data\Factory();
37 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
38 return new \ILIAS\BookingManager\StandardGUIRequest(
39 $http_mock,
41 $get,
42 $post
43 );
44 }
45
46 public function testRefId(): void
47 {
48 $request = $this->getRequest(
49 [
50 "ref_id" => "5"
51 ],
52 []
53 );
54
55 $this->assertEquals(
56 5,
57 $request->getRefId()
58 );
59 }
60
61 public function testPoolRefId(): void
62 {
63 $request = $this->getRequest(
64 [
65 "pool_ref_id" => "6"
66 ],
67 []
68 );
69
70 $this->assertEquals(
71 6,
72 $request->getPoolRefId()
73 );
74 }
75
76 public function testReservationIds(): void
77 {
78 $request = $this->getRequest(
79 [
80 ],
81 [
82 "reservation_id" => ["4", "6", "8"]
83 ]
84 );
85
86 $this->assertEquals(
87 [4, 6, 8],
88 $request->getReservationIds()
89 );
90 }
91}
$post
Definition: ltitoken.php:46
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.