ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest Class Reference
+ Inheritance diagram for ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest:
+ Collaboration diagram for ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest:

Public Member Functions

 setUp ()
 
 testGetHash ()
 
 testHashIsDifferentForDifferentMessages ()
 
 testGetLabel ()
 
 testIsNotable ()
 
 testGetPreconditions ()
 
 testAchieveFalse ()
 
 testAchieveTrue ()
 
 testNotExecutable ()
 
 testUnachievable ()
 

Protected Attributes

string $label_t
 
Condition ExternalConditionObjective $t
 
string $label_f
 
Condition ExternalConditionObjective $f
 

Detailed Description

Definition at line 27 of file ExternalConditionObjectiveTest.php.

Member Function Documentation

◆ setUp()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::setUp ( )

Definition at line 34 of file ExternalConditionObjectiveTest.php.

34 : void
35 {
36 $this->label_t = "condition_true";
37 $this->t = new Condition\ExternalConditionObjective(
38 $this->label_t,
39 function (Setup\Environment $e) {
40 return true;
41 }
42 );
43 $this->label_f = "condition_false";
44 $this->f = new Condition\ExternalConditionObjective(
45 $this->label_f,
46 function (Setup\Environment $e) {
47 return false;
48 }
49 );
50 }

References Vendor\Package\$e.

◆ testAchieveFalse()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testAchieveFalse ( )

Definition at line 82 of file ExternalConditionObjectiveTest.php.

82 : void
83 {
84 $this->expectException(Setup\UnachievableException::class);
85 $env = $this->createMock(Setup\Environment::class);
86 $this->f->achieve($env);
87 }

◆ testAchieveTrue()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testAchieveTrue ( )

Definition at line 89 of file ExternalConditionObjectiveTest.php.

89 : void
90 {
91 $env = $this->createMock(Setup\Environment::class);
92 $res = $this->t->achieve($env);
93 $this->assertEquals($env, $res);
94 }
$res
Definition: ltiservices.php:69

References $res.

◆ testGetHash()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testGetHash ( )

Definition at line 52 of file ExternalConditionObjectiveTest.php.

52 : void
53 {
54 $this->assertIsString($this->t->getHash());
55 }

◆ testGetLabel()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testGetLabel ( )

Definition at line 62 of file ExternalConditionObjectiveTest.php.

62 : void
63 {
64 $this->assertIsString($this->f->getLabel());
65 $this->assertEquals($this->label_f, $this->f->getLabel());
66 $this->assertEquals($this->label_t, $this->t->getLabel());
67 }

◆ testGetPreconditions()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testGetPreconditions ( )

Definition at line 74 of file ExternalConditionObjectiveTest.php.

74 : void
75 {
76 $env = $this->createMock(Setup\Environment::class);
77
78 $pre = $this->f->getPreconditions($env);
79 $this->assertEquals([], $pre);
80 }

◆ testHashIsDifferentForDifferentMessages()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testHashIsDifferentForDifferentMessages ( )

Definition at line 57 of file ExternalConditionObjectiveTest.php.

57 : void
58 {
59 $this->assertNotEquals($this->t->getHash(), $this->f->getHash());
60 }

◆ testIsNotable()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testIsNotable ( )

Definition at line 69 of file ExternalConditionObjectiveTest.php.

69 : void
70 {
71 $this->assertTrue($this->f->isNotable());
72 }

◆ testNotExecutable()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testNotExecutable ( )

Definition at line 96 of file ExternalConditionObjectiveTest.php.

96 : void
97 {
98 $env = $this->createMock(Setup\Environment::class);
99
100 $throws_not_executable = new Condition\ExternalConditionObjective(
101 "Not executable",
102 function (Setup\Environment $e) {
103 return false;
104 },
105 null,
106 true
107 );
108
109 $this->expectException(Setup\NotExecutableException::class);
110 $throws_not_executable->achieve($env);
111 }
return true

References Vendor\Package\$e, and true.

◆ testUnachievable()

ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::testUnachievable ( )

Definition at line 113 of file ExternalConditionObjectiveTest.php.

113 : void
114 {
115 $env = $this->createMock(Setup\Environment::class);
116
117 $throws_unachievable = new Condition\ExternalConditionObjective(
118 "Unachievable",
119 function (Setup\Environment $e) {
120 return false;
121 },
122 null,
123 false
124 );
125
126 $this->expectException(Setup\UnachievableException::class);
127 $throws_unachievable->achieve($env);
128 }

References Vendor\Package\$e.

Field Documentation

◆ $f

Condition ExternalConditionObjective ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::$f
protected

Definition at line 32 of file ExternalConditionObjectiveTest.php.

◆ $label_f

string ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::$label_f
protected

Definition at line 31 of file ExternalConditionObjectiveTest.php.

◆ $label_t

string ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::$label_t
protected

Definition at line 29 of file ExternalConditionObjectiveTest.php.

◆ $t

Condition ExternalConditionObjective ILIAS\Tests\Setup\Condition\ExternalConditionObjectiveTest::$t
protected

Definition at line 30 of file ExternalConditionObjectiveTest.php.


The documentation for this class was generated from the following file: