ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
PostDataFromServerRequestTestTBD.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
require_once(__DIR__ .
"/../../../../../../../../vendor/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
testGetSuccess
(): void
39
{
40
$this->assertEquals(
"bar"
, $this->post_data->get(
"foo"
));
41
}
42
43
public
function
testGetFail
(): 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
testGetOrMatch
(): void
55
{
56
$this->assertEquals(
"bar"
, $this->post_data->getOr(
"foo"
,
"baz"
));
57
}
58
59
public
function
testGetOrNoMatch
(): void
60
{
61
$this->assertEquals(
"blaw"
, $this->post_data->getOr(
"baz"
,
"blaw"
));
62
}
63
}
LogicException
ILIAS\UI\Implementation\Component\Input\PostDataFromServerRequest
Implements interaction of input element with post data from psr-7 server request. ...
Definition:
PostDataFromServerRequest.php:31
PostDataFromServerRequestTest\$post_data
PostDataFromServerRequest $post_data
Definition:
PostDataFromServerRequestTestTBD.php:29
PostDataFromServerRequest
Vendor\Package\$e
$e
Definition:
example_cleaned.php:49
PostDataFromServerRequestTest\testGetFail
testGetFail()
Definition:
PostDataFromServerRequestTestTBD.php:43
PostDataFromServerRequestTest\testGetOrNoMatch
testGetOrNoMatch()
Definition:
PostDataFromServerRequestTestTBD.php:59
PostDataFromServerRequestTest\testGetSuccess
testGetSuccess()
Definition:
PostDataFromServerRequestTestTBD.php:38
PostDataFromServerRequestTest
Definition:
PostDataFromServerRequestTestTBD.php:27
PostDataFromServerRequestTest\testGetOrMatch
testGetOrMatch()
Definition:
PostDataFromServerRequestTestTBD.php:54
ServerRequestInterface
PostDataFromServerRequestTest\setUp
setUp()
Definition:
PostDataFromServerRequestTestTBD.php:31
TestCase
TestCase
components
ILIAS
UI
tests
Component
Input
Container
Form
PostDataFromServerRequestTestTBD.php
Generated on Wed Sep 3 2025 23:04:18 for ILIAS by
1.8.13 (using
Doxyfile
)