ILIAS  release_8 Revision v8.24
SuperGlobalDropInReplacementTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/******************************************************************************
6 *
7 * This file is part of ILIAS, a powerful learning management system.
8 *
9 * ILIAS is licensed with the GPL-3.0, you should have received a copy
10 * of said license along with the source code.
11 *
12 * If this is not the case or you just want to try ILIAS, you'll find
13 * us at:
14 * https://www.ilias.de
15 * https://github.com/ILIAS-eLearning
16 *
17 *****************************************************************************/
18
19namespace ILIAS\HTTP;
20
22require_once "AbstractBaseTest.php";
23
24use ILIAS\Data\Factory as DataFactory;
26use ILIAS\Refinery\Factory as Refinery;
27use ilLanguage;
28use OutOfBoundsException;
29
31{
32 private function getRefinery(): Refinery
33 {
34 return new Refinery(
35 new DataFactory(),
36 $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
37 );
38 }
39
41 {
42 $super_global = new SuperGlobalDropInReplacement($this->getRefinery(), ['foo' => 'bar']);
43 $super_global['foo'] = 'phpunit';
44
45 self::assertEquals('phpunit', $super_global['foo']);
46 }
47
49 {
50 $this->expectException(OutOfBoundsException::class);
51
52 $super_global = new SuperGlobalDropInReplacement($this->getRefinery(), ['foo' => 'bar'], true);
53 $super_global['foo'] = 'phpunit';
54 }
55}
Builds data types.
Definition: Factory.php:21
Class AbstractBaseTest.
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...