ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
ObjectiveWithPreconditionsTest.php
Go to the documentation of this file.
1
<?php
2
3
/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5
namespace
ILIAS\Tests\Setup
;
6
7
use
ILIAS\Setup
;
8
9
class
ObjectiveWithPreconditionsTest
extends
\PHPUnit\Framework\TestCase
10
{
11
use
Helper
;
12
13
public
function
setUp
() : void
14
{
15
$this->objective = $this->newObjective();
16
$this->precondition = $this->newObjective();
17
18
$this->with_precondition =
new
Setup\ObjectiveWithPreconditions
(
19
$this->objective,
20
$this->precondition
21
);
22
}
23
24
public
function
testGetHash
()
25
{
26
$this->assertEquals($this->objective->getHash(), $this->with_precondition->getHash());
27
}
28
29
public
function
testGetLabel
()
30
{
31
$label =
"some_label"
;
32
33
$this->objective
34
->expects($this->once())
35
->method(
"getLabel"
)
36
->willReturn($label);
37
38
$this->assertEquals($label, $this->with_precondition->getLabel());
39
}
40
41
public
function
testIsNotable
()
42
{
43
$notable =
true
;
44
45
$this->objective
46
->expects($this->once())
47
->method(
"isNotable"
)
48
->willReturn($notable);
49
50
$this->assertEquals($notable, $this->with_precondition->isNotable());
51
}
52
53
public
function
testGetPreconditions
()
54
{
55
$another = $this->newObjective();
56
57
$env = $this->createMock(Setup\Environment::class);
58
59
$this->objective
60
->expects($this->once())
61
->method(
"getPreconditions"
)
62
->with($env)
63
->willReturn([$another]);
64
65
$pre = $this->with_precondition->getPreconditions($env);
66
$this->assertEquals([$this->precondition, $another], $pre);
67
}
68
69
70
public
function
testAchieve
()
71
{
72
$env = $this->createMock(Setup\Environment::class);
73
74
$this->objective
75
->expects($this->once())
76
->method(
"achieve"
)
77
->with($env)
78
->willReturn($env);
79
80
$res
= $this->with_precondition->achieve($env);
81
$this->assertSame($env,
$res
);
82
}
83
}
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\testGetLabel
testGetLabel()
Definition:
ObjectiveWithPreconditionsTest.php:29
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\setUp
setUp()
Definition:
ObjectiveWithPreconditionsTest.php:13
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\testGetHash
testGetHash()
Definition:
ObjectiveWithPreconditionsTest.php:24
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
Helper
ILIAS\Setup\ObjectiveWithPreconditions
A wrapper around an objective that adds some preconditions.
Definition:
ObjectiveWithPreconditions.php:15
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\testAchieve
testAchieve()
Definition:
ObjectiveWithPreconditionsTest.php:70
ILIAS\Setup
Definition:
AchievementTracker.php:5
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\testGetPreconditions
testGetPreconditions()
Definition:
ObjectiveWithPreconditionsTest.php:53
ILIAS\Tests\Setup
Definition:
AdminConfirmedObjectiveTest.php:5
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest\testIsNotable
testIsNotable()
Definition:
ObjectiveWithPreconditionsTest.php:41
ILIAS\Tests\Setup\ObjectiveWithPreconditionsTest
Definition:
ObjectiveWithPreconditionsTest.php:9
tests
Setup
ObjectiveWithPreconditionsTest.php
Generated on Wed Sep 3 2025 20:01:31 for ILIAS by
1.8.13 (using
Doxyfile
)