ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
PostDataFromServerRequestTest.php
Go to the documentation of this file.
1
<?php
2
3
/* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5
require_once(__DIR__ .
"/../../../../../../libs/composer/vendor/autoload.php"
);
6
7
use \ILIAS\UI\Implementation\Component\Input\Container\Form\PostDataFromServerRequest;
8
9
use
Psr\Http\Message\ServerRequestInterface
;
10
use
PHPUnit\Framework\TestCase
;
11
12
class
PostDataFromServerRequestTest
extends
TestCase
13
{
14
public
function
setUp
() : void
15
{
16
$request = \Mockery::mock(ServerRequestInterface::class);
17
$request->shouldReceive(
"getParsedBody"
)->andReturn([
"foo"
=>
"bar"
]);
18
$this->post_data =
new
PostDataFromServerRequest
($request);
19
}
20
21
22
public
function
test_get_success
()
23
{
24
$this->assertEquals(
"bar"
, $this->post_data->get(
"foo"
));
25
}
26
27
28
public
function
test_get_fail
()
29
{
30
$raised =
false
;
31
try
{
32
$this->post_data->get(
"baz"
);
33
}
catch
(\
LogicException
$e
) {
34
$raised =
true
;
35
}
36
$this->assertTrue($raised,
"Logic exception was raised."
);
37
}
38
39
40
public
function
test_getOr_match
()
41
{
42
$this->assertEquals(
"bar"
, $this->post_data->getOr(
"foo"
,
"baz"
));
43
}
44
45
46
public
function
test_getOr_no_match
()
47
{
48
$this->assertEquals(
"blaw"
, $this->post_data->getOr(
"baz"
,
"blaw"
));
49
}
50
}
LogicException
PostDataFromServerRequestTest\test_getOr_match
test_getOr_match()
Definition:
PostDataFromServerRequestTest.php:40
PostDataFromServerRequestTest\test_getOr_no_match
test_getOr_no_match()
Definition:
PostDataFromServerRequestTest.php:46
Vendor\Package\$e
$e
Definition:
example_cleaned.php:31
PostDataFromServerRequestTest
Definition:
PostDataFromServerRequestTest.php:12
ServerRequestInterface
ILIAS\UI\Implementation\Component\Input\Container\Form\PostDataFromServerRequest
Implements interaction of input element with post data from psr-7 server request. ...
Definition:
PostDataFromServerRequest.php:15
PostDataFromServerRequestTest\test_get_fail
test_get_fail()
Definition:
PostDataFromServerRequestTest.php:28
PostDataFromServerRequestTest\setUp
setUp()
Definition:
PostDataFromServerRequestTest.php:14
PostDataFromServerRequestTest\test_get_success
test_get_success()
Definition:
PostDataFromServerRequestTest.php:22
TestCase
tests
UI
Component
Input
Container
Form
PostDataFromServerRequestTest.php
Generated on Thu Apr 10 2025 20:01:38 for ILIAS by
1.8.13 (using
Doxyfile
)