19use PHPUnit\Framework\TestCase;
67 protected function setUp(): void
76 public function started(
string $class,
int $step):
void
79 public function finished(
string $class,
int $step):
void
82 public function getLastStartedStep(
string $class):
int
86 public function getLastFinishedStep(
string $class):
int
93 $db = $this->createMock(ilDBInterface::class);
95 ilDBStepReader::class => $steps_reader,
96 ilDBStepExecutionDB::class => $execution_log,
97 Environment::RESOURCE_DATABASE => $db
100 $db->expects($this->exactly(3))
103 $this->objective->achieve($env);
105 $this->assertEquals([1,2,4], $this->steps->called);
117 public function started(
string $class,
int $step):
void
119 $this->test->steps->called[] = [
"started", $class, $step];
121 public function finished(
string $class,
int $step):
void
123 $this->test->steps->called[] = [
"finished", $class, $step];
125 public function getLastStartedStep(
string $class):
int
129 public function getLastFinishedStep(
string $class):
int
136 $db = $this->createMock(ilDBInterface::class);
138 ilDBStepReader::class => $steps_reader,
139 ilDBStepExecutionDB::class => $execution_log,
140 Environment::RESOURCE_DATABASE => $db
143 $this->objective->achieve($env);
146 [
"started", Test_ilDatabaseUpdateSteps::class, 1],
148 [
"finished", Test_ilDatabaseUpdateSteps::class, 1],
149 [
"started", Test_ilDatabaseUpdateSteps::class, 2],
151 [
"finished", Test_ilDatabaseUpdateSteps::class, 2],
152 [
"started", Test_ilDatabaseUpdateSteps::class, 4],
154 [
"finished", Test_ilDatabaseUpdateSteps::class, 4]
157 $this->assertEquals($expected, $this->steps->called);
163 public function started(
string $class,
int $step):
void
166 public function finished(
string $class,
int $step):
void
169 public function getLastStartedStep(
string $class):
int
173 public function getLastFinishedStep(
string $class):
int
180 $db = $this->createMock(ilDBInterface::class);
182 ilDBStepReader::class => $steps_reader,
183 ilDBStepExecutionDB::class => $execution_log,
184 Environment::RESOURCE_DATABASE => $db
187 $db->expects($this->exactly(2))
190 $this->objective->achieve($env);
192 $this->assertEquals([2,4], $this->steps->called);
197 $this->expectException(RuntimeException::class);
200 public function started(
string $class,
int $step):
void
203 public function finished(
string $class,
int $step):
void
206 public function getLastStartedStep(
string $class):
int
210 public function getLastFinishedStep(
string $class):
int
215 $db = $this->createMock(ilDBInterface::class);
217 ilDBStepExecutionDB::class => $execution_log,
218 Environment::RESOURCE_DATABASE => $db
220 $this->objective->achieve($env);
prepare(ilDBInterface $db)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testOnlyExecuteNonExecutedSteps()
Test_ilDatabaseUpdateSteps $steps
testExceptionOnNonMatchingStartAndFinished()
ilDatabaseUpdateStepsExecutedObjective $objective
testCorrectExecutionOrder()
This class attempt to achieve a set of database update steps.
An environment holds resources to be used in the setup process.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc