ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
PostDataFromServerRequestTest.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
21
require_once(__DIR__ .
"/../../../../../../libs/composer/vendor/autoload.php"
);
22
23
use
ILIAS\UI\Implementation\Component\Input\PostDataFromServerRequest
;
24
use Psr\Http\Message\ServerRequestInterface;
25
use PHPUnit\Framework\TestCase;
26
27
class
PostDataFromServerRequestTest
extends
TestCase
28
{
29
protected
PostDataFromServerRequest
$post_data
;
30
31
public
function
setUp
(): void
32
{
33
$request = Mockery::mock(ServerRequestInterface::class);
34
$request->shouldReceive(
"getParsedBody"
)->andReturn([
"foo"
=>
"bar"
]);
35
$this->post_data =
new
PostDataFromServerRequest
($request);
36
}
37
38
public
function
test_get_success
(): void
39
{
40
$this->assertEquals(
"bar"
, $this->post_data->get(
"foo"
));
41
}
42
43
public
function
test_get_fail
(): void
44
{
45
$raised =
false
;
46
try
{
47
$this->post_data->get(
"baz"
);
48
}
catch
(LogicException
$e
) {
49
$raised =
true
;
50
}
51
$this->assertTrue($raised,
"Logic exception was raised."
);
52
}
53
54
public
function
test_getOr_match
(): void
55
{
56
$this->assertEquals(
"bar"
, $this->post_data->getOr(
"foo"
,
"baz"
));
57
}
58
59
public
function
test_getOr_no_match
(): void
60
{
61
$this->assertEquals(
"blaw"
, $this->post_data->getOr(
"baz"
,
"blaw"
));
62
}
63
}
ILIAS\UI\Implementation\Component\Input\PostDataFromServerRequest
Implements interaction of input element with post data from psr-7 server request.
Definition:
PostDataFromServerRequest.php:31
PostDataFromServerRequestTest
Definition:
PostDataFromServerRequestTest.php:28
PostDataFromServerRequestTest\setUp
setUp()
Definition:
PostDataFromServerRequestTest.php:31
PostDataFromServerRequestTest\$post_data
PostDataFromServerRequest $post_data
Definition:
PostDataFromServerRequestTest.php:29
PostDataFromServerRequestTest\test_get_fail
test_get_fail()
Definition:
PostDataFromServerRequestTest.php:43
PostDataFromServerRequestTest\test_getOr_match
test_getOr_match()
Definition:
PostDataFromServerRequestTest.php:54
PostDataFromServerRequestTest\test_get_success
test_get_success()
Definition:
PostDataFromServerRequestTest.php:38
PostDataFromServerRequestTest\test_getOr_no_match
test_getOr_no_match()
Definition:
PostDataFromServerRequestTest.php:59
Vendor\Package\$e
$e
Definition:
example_cleaned.php:49
tests
UI
Component
Input
Container
Form
PostDataFromServerRequestTest.php
Generated on Sun Nov 2 2025 22:02:05 for ILIAS by
1.9.4 (using
Doxyfile
)