ILIAS
trunk Revision v11.0_alpha-3011-gc6b235a2e85
◀ ilDoc Overview
SuperGlobalDropInReplacementTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\HTTP
;
22
23
use
ILIAS\Data\Factory
as DataFactory;
24
use
ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement
;
25
use
ILIAS\Refinery\Factory
as Refinery;
26
use
ilLanguage
;
27
use OutOfBoundsException;
28
29
class
SuperGlobalDropInReplacementTest
extends
AbstractBaseTestCase
30
{
31
private
function
getRefinery
():
Refinery
32
{
33
return
new
Refinery
(
34
new
DataFactory(),
35
$this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
36
);
37
}
38
39
public
function
testValueCanBeAssignedIfSuperGlobalIsMutable
(): void
40
{
41
$super_global =
new
SuperGlobalDropInReplacement
($this->
getRefinery
(), [
'foo'
=>
'bar'
]);
42
$super_global[
'foo'
] =
'phpunit'
;
43
44
$this->assertEquals(
'phpunit'
, $super_global[
'foo'
]);
45
}
46
47
public
function
testExceptionIsRaisedIfValueIsAssignedButSuperGlobalIsImmutable
(): void
48
{
49
$this->expectException(OutOfBoundsException::class);
50
51
$super_global =
new
SuperGlobalDropInReplacement
($this->
getRefinery
(), [
'foo'
=>
'bar'
],
true
);
52
$super_global[
'foo'
] =
'phpunit'
;
53
}
54
}
ILIAS\Data\Factory
Builds data types.
Definition:
Factory.php:36
ILIAS\HTTP\AbstractBaseTestCase
Class AbstractBaseTest.
Definition:
AbstractBaseTestCase.php:32
ILIAS\HTTP\SuperGlobalDropInReplacementTest
Definition:
SuperGlobalDropInReplacementTest.php:30
ILIAS\HTTP\SuperGlobalDropInReplacementTest\testValueCanBeAssignedIfSuperGlobalIsMutable
testValueCanBeAssignedIfSuperGlobalIsMutable()
Definition:
SuperGlobalDropInReplacementTest.php:39
ILIAS\HTTP\SuperGlobalDropInReplacementTest\getRefinery
getRefinery()
Definition:
SuperGlobalDropInReplacementTest.php:31
ILIAS\HTTP\SuperGlobalDropInReplacementTest\testExceptionIsRaisedIfValueIsAssignedButSuperGlobalIsImmutable
testExceptionIsRaisedIfValueIsAssignedButSuperGlobalIsImmutable()
Definition:
SuperGlobalDropInReplacementTest.php:47
ILIAS\HTTP\Wrapper\SuperGlobalDropInReplacement
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
Definition:
SuperGlobalDropInReplacement.php:34
ILIAS\Refinery
Definition:
Refinery.php:24
ilLanguage
language handling
Definition:
class.ilLanguage.php:43
ILIAS\HTTP
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
components
ILIAS
HTTP
tests
Services
SuperGlobalDropInReplacementTest.php
Generated on Sun Oct 19 2025 23:03:02 for ILIAS by
1.9.4 (using
Doxyfile
)