Class WrapperTest.
More...
◆ setUp()
| ILIAS\HTTP\WrapperTest::setUp |
( |
| ) |
|
|
protected |
◆ testCookie()
| ILIAS\HTTP\WrapperTest::testCookie |
( |
| ) |
|
Definition at line 122 of file WrapperTest.php.
122 : void
123 {
124 $wrapper_factory = new WrapperFactory($this->request_interface);
125
126 $this->request_interface->expects($this->once())
127 ->method('getCookieParams')
128 ->willReturn($this->cookie);
129
130 $cookie = $wrapper_factory->cookie();
131
132 $this->assertTrue(
$cookie->has(
'key_one'));
133 $this->assertTrue(
$cookie->has(
'key_two'));
134 $this->assertFalse(
$cookie->has(
'key_three'));
135
136 $string_trafo = $this->
refinery->kindlyTo()->string();
137 $int_trafo = $this->
refinery->kindlyTo()->int();
138
139 $this->assertEquals(
"1",
$cookie->retrieve(
'key_one', $string_trafo));
140 $this->assertIsString(
$cookie->retrieve(
'key_one', $string_trafo));
141
142 $this->assertEquals(1,
$cookie->retrieve(
'key_one', $string_trafo));
143 $this->assertIsInt(
$cookie->retrieve(
'key_one', $int_trafo));
144 }
References ILIAS\HTTP\WrapperTest\$cookie, and ILIAS\Repository\refinery().
◆ testPost()
| ILIAS\HTTP\WrapperTest::testPost |
( |
| ) |
|
Definition at line 98 of file WrapperTest.php.
98 : void
99 {
100 $wrapper_factory = new WrapperFactory($this->request_interface);
101
102 $this->request_interface->expects($this->once())
103 ->method('getParsedBody')
104 ->willReturn($this->post);
105
106 $post = $wrapper_factory->post();
107
108 $this->assertTrue(
$post->has(
'key_one'));
109 $this->assertTrue(
$post->has(
'key_two'));
110 $this->assertFalse(
$post->has(
'key_three'));
111
112 $string_trafo = $this->
refinery->kindlyTo()->string();
113 $int_trafo = $this->
refinery->kindlyTo()->int();
114
115 $this->assertEquals(
"1",
$post->retrieve(
'key_one', $string_trafo));
116 $this->assertIsString(
$post->retrieve(
'key_one', $string_trafo));
117
118 $this->assertEquals(1,
$post->retrieve(
'key_one', $string_trafo));
119 $this->assertIsInt(
$post->retrieve(
'key_one', $int_trafo));
120 }
References ILIAS\HTTP\WrapperTest\$post, and ILIAS\Repository\refinery().
◆ testQuery()
| ILIAS\HTTP\WrapperTest::testQuery |
( |
| ) |
|
Definition at line 74 of file WrapperTest.php.
74 : void
75 {
76 $wrapper_factory = new WrapperFactory($this->request_interface);
77
78 $this->request_interface->expects($this->once())
79 ->method('getQueryParams')
80 ->willReturn($this->get);
81
82 $query = $wrapper_factory->query();
83
84 $this->assertTrue(
$query->has(
'key_one'));
85 $this->assertTrue(
$query->has(
'key_two'));
86 $this->assertFalse(
$query->has(
'key_three'));
87
88 $string_trafo = $this->
refinery->kindlyTo()->string();
89 $int_trafo = $this->
refinery->kindlyTo()->int();
90
91 $this->assertEquals(
"1",
$query->retrieve(
'key_one', $string_trafo));
92 $this->assertIsString(
$query->retrieve(
'key_one', $string_trafo));
93
94 $this->assertEquals(1,
$query->retrieve(
'key_one', $string_trafo));
95 $this->assertIsInt(
$query->retrieve(
'key_one', $int_trafo));
96 }
References $query, and ILIAS\Repository\refinery().
◆ testWrapperfactory()
| ILIAS\HTTP\WrapperTest::testWrapperfactory |
( |
| ) |
|
Definition at line 48 of file WrapperTest.php.
48 : void
49 {
50 $wrapper_factory = new WrapperFactory($this->request_interface);
51
52
53 $this->request_interface->expects($this->once())
54 ->method('getQueryParams')
55 ->willReturn([]);
56
57 $wrapper_factory->query();
58
59
60 $this->request_interface->expects($this->once())
61 ->method('getParsedBody')
62 ->willReturn([]);
63
64 $wrapper_factory->post();
65
66
67 $this->request_interface->expects($this->once())
68 ->method('getCookieParams')
69 ->willReturn([]);
70
71 $wrapper_factory->cookie();
72 }
◆ $cookie
| array ILIAS\HTTP\WrapperTest::$cookie = ['key_one' => 1, 'key_two' => 2] |
|
protected |
◆ $get
| array ILIAS\HTTP\WrapperTest::$get = ['key_one' => 1, 'key_two' => 2] |
|
protected |
◆ $post
| array ILIAS\HTTP\WrapperTest::$post = ['key_one' => 1, 'key_two' => 2] |
|
protected |
◆ $refinery
| Factory ILIAS\HTTP\WrapperTest::$refinery |
|
protected |
The documentation for this class was generated from the following file: