ILIAS  release_8 Revision v8.24
ilConditionsTest.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 * published by ILIAS open source e-Learning e.V.
9 *
10 * ILIAS is licensed with the GPL-3.0,
11 * see https://www.gnu.org/licenses/gpl-3.0.en.html
12 * You should have received a copy of said license along with the
13 * source code, too.
14 *
15 * If this is not the case or you just want to try ILIAS, you'll find
16 * us at:
17 * https://www.ilias.de
18 * https://github.com/ILIAS-eLearning
19 *
20 *****************************************************************************/
21
22use PHPUnit\Framework\TestCase;
24
30class ilConditionsTest extends TestCase
31{
32 protected $backupGlobals = false;
33
34 protected Container $dic;
35
36 public function testCondition(): void
37 {
38 $condition = new ilCondition(new ilConditionTrigger(1, 2, 'drei'), 'invalid');
39 $obligatory_condition = $condition->withObligatory(true);
40 $this->assertTrue($obligatory_condition->getObligatory());
41 $this->assertFalse($condition->getObligatory());
42 }
43
47 protected function setGlobalVariable(string $name, $value): void
48 {
49 global $DIC;
50
51 $GLOBALS[$name] = $value;
52 unset($DIC[$name]);
53 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
54 return $value;
55 };
56 }
57}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Represents a condition trigger object.
Condition class.
Unit tests for class ilCopyWizardOptions.
setGlobalVariable(string $name, $value)
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247