ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SuperGlobalDropInReplacementTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(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 
19 namespace ILIAS\HTTP;
20 
22 require_once "AbstractBaseTest.php";
23 
27 use ilLanguage;
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
Class AbstractBaseTest.