ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilConditionsTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
23
29class ilConditionsTest extends TestCase
30{
31 protected $backupGlobals = false;
32
33 protected Container $dic;
34
35 public function testCondition(): void
36 {
37 $condition = new ilCondition(new ilConditionTrigger(1, 2, 'drei'), 'invalid');
38 $obligatory_condition = $condition->withObligatory(true);
39 $this->assertTrue($obligatory_condition->getObligatory());
40 $this->assertFalse($condition->getObligatory());
41 }
42
46 protected function setGlobalVariable(string $name, $value): void
47 {
48 global $DIC;
49
50 $GLOBALS[$name] = $value;
51 unset($DIC[$name]);
52 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
53 return $value;
54 };
55 }
56}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Represents a condition trigger object.
Condition class.
Unit tests for class ilCopyWizardOptions.
setGlobalVariable(string $name, $value)
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54