ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SuperGlobalDropInReplacementTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\HTTP;
22
23use ILIAS\Data\Factory as DataFactory;
25use ILIAS\Refinery\Factory as Refinery;
26use ilLanguage;
27use OutOfBoundsException;
28
30{
31 private function getRefinery(): Refinery
32 {
33 return new Refinery(
34 new DataFactory(),
35 $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
36 );
37 }
38
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
48 {
49 $this->expectException(OutOfBoundsException::class);
50
51 $super_global = new SuperGlobalDropInReplacement($this->getRefinery(), ['foo' => 'bar'], true);
52 $super_global['foo'] = 'phpunit';
53 }
54}
Builds data types.
Definition: Factory.php:36
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...