ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Tests\Setup\Objective\TentativelyTest Class Reference
+ Inheritance diagram for ILIAS\Tests\Setup\Objective\TentativelyTest:
+ Collaboration diagram for ILIAS\Tests\Setup\Objective\TentativelyTest:

Public Member Functions

 setUp ()
 
 testGetHash ()
 
 testDoubleTentativelyGetHash ()
 
 testGetLabel ()
 
 testDoubleTentativelyGetLabel ()
 
 testIsNotable ()
 
 testGetPreconditions ()
 
 testAchieve ()
 
 testAchieveThrows ()
 
 testIsApplicable ()
 

Protected Attributes

Setup Objective $objective
 
Setup Objective $precondition
 
Objective Tentatively $tentatively
 
Objective Tentatively $double_tentatively
 

Detailed Description

Definition at line 30 of file TentativelyTest.php.

Member Function Documentation

◆ setUp()

ILIAS\Tests\Setup\Objective\TentativelyTest::setUp ( )

Definition at line 39 of file TentativelyTest.php.

39  : void
40  {
41  $this->objective = $this->newObjective();
42  $this->precondition = $this->newObjective();
43 
44  $this->tentatively = new Objective\Tentatively($this->objective);
45  $this->double_tentatively = new Objective\Tentatively($this->tentatively);
46  }

◆ testAchieve()

ILIAS\Tests\Setup\Objective\TentativelyTest::testAchieve ( )

Definition at line 122 of file TentativelyTest.php.

References $res.

122  : void
123  {
124  $env = $this->createMock(Setup\Environment::class);
125 
126  $this->objective
127  ->expects($this->once())
128  ->method("achieve")
129  ->with($env)
130  ->willReturn($env);
131 
132  $res = $this->tentatively->achieve($env);
133  $this->assertSame($env, $res);
134  }
$res
Definition: ltiservices.php:66

◆ testAchieveThrows()

ILIAS\Tests\Setup\Objective\TentativelyTest::testAchieveThrows ( )

Definition at line 136 of file TentativelyTest.php.

References $res.

136  : void
137  {
138  $env = $this->createMock(Setup\Environment::class);
139 
140  $this->objective
141  ->expects($this->once())
142  ->method("achieve")
143  ->with($env)
144  ->will($this->throwException(new Setup\UnachievableException()));
145 
146  $res = $this->tentatively->achieve($env);
147  $this->assertSame($env, $res);
148  }
$res
Definition: ltiservices.php:66

◆ testDoubleTentativelyGetHash()

ILIAS\Tests\Setup\Objective\TentativelyTest::testDoubleTentativelyGetHash ( )

Definition at line 56 of file TentativelyTest.php.

56  : void
57  {
58  $this->assertEquals(
59  $this->tentatively->getHash(),
60  $this->double_tentatively->getHash()
61  );
62  }

◆ testDoubleTentativelyGetLabel()

ILIAS\Tests\Setup\Objective\TentativelyTest::testDoubleTentativelyGetLabel ( )

Definition at line 79 of file TentativelyTest.php.

79  : void
80  {
81  $label = "some_label";
82 
83  $this->objective
84  ->method("getLabel")
85  ->willReturn($label);
86 
87  $this->assertEquals(
88  $this->tentatively->getLabel(),
89  $this->double_tentatively->getLabel()
90  );
91  }

◆ testGetHash()

ILIAS\Tests\Setup\Objective\TentativelyTest::testGetHash ( )

Definition at line 48 of file TentativelyTest.php.

48  : void
49  {
50  $this->assertEquals(
51  "tentatively " . $this->objective->getHash(),
52  $this->tentatively->getHash()
53  );
54  }

◆ testGetLabel()

ILIAS\Tests\Setup\Objective\TentativelyTest::testGetLabel ( )

Definition at line 64 of file TentativelyTest.php.

64  : void
65  {
66  $label = "some_label";
67 
68  $this->objective
69  ->expects($this->once())
70  ->method("getLabel")
71  ->willReturn($label);
72 
73  $this->assertEquals(
74  "Tentatively: $label",
75  $this->tentatively->getLabel()
76  );
77  }

◆ testGetPreconditions()

ILIAS\Tests\Setup\Objective\TentativelyTest::testGetPreconditions ( )

Definition at line 104 of file TentativelyTest.php.

104  : void
105  {
106  $other = $this->newObjective();
107 
108  $env = $this->createMock(Setup\Environment::class);
109 
110  $this->objective
111  ->expects($this->once())
112  ->method("getPreconditions")
113  ->with($env)
114  ->willReturn([$other]);
115 
116  $this->assertEquals(
117  [new Objective\Tentatively($other)],
118  $this->tentatively->getPreconditions($env)
119  );
120  }

◆ testIsApplicable()

ILIAS\Tests\Setup\Objective\TentativelyTest::testIsApplicable ( )

Definition at line 150 of file TentativelyTest.php.

150  : void
151  {
152  $env = $this->createMock(Setup\Environment::class);
153  $is_applicable = random_int(0, 1) == 1;
154 
155  $this->objective
156  ->expects($this->once())
157  ->method("isApplicable")
158  ->with($env)
159  ->willReturn($is_applicable);
160 
161  $this->assertEquals($is_applicable, $this->tentatively->isApplicable($env));
162  }

◆ testIsNotable()

ILIAS\Tests\Setup\Objective\TentativelyTest::testIsNotable ( )

Definition at line 92 of file TentativelyTest.php.

92  : void
93  {
94  $notable = true;
95 
96  $this->objective
97  ->method("isNotable")
98  ->willReturn($notable);
99 
100  $this->assertEquals($notable, $this->tentatively->isNotable());
101  $this->assertEquals($notable, $this->double_tentatively->isNotable());
102  }

Field Documentation

◆ $double_tentatively

Objective Tentatively ILIAS\Tests\Setup\Objective\TentativelyTest::$double_tentatively
protected

Definition at line 37 of file TentativelyTest.php.

◆ $objective

Setup Objective ILIAS\Tests\Setup\Objective\TentativelyTest::$objective
protected

Definition at line 34 of file TentativelyTest.php.

◆ $precondition

Setup Objective ILIAS\Tests\Setup\Objective\TentativelyTest::$precondition
protected

Definition at line 35 of file TentativelyTest.php.

◆ $tentatively

Objective Tentatively ILIAS\Tests\Setup\Objective\TentativelyTest::$tentatively
protected

Definition at line 36 of file TentativelyTest.php.


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