19use PHPUnit\Framework\TestCase;
66 protected function setUp(): void
75 public function started(
string $class,
int $step):
void
78 public function finished(
string $class,
int $step):
void
81 public function getLastStartedStep(
string $class):
int
85 public function getLastFinishedStep(
string $class):
int
92 $db = $this->createMock(ilDBInterface::class);
94 ilDBStepReader::class => $steps_reader,
95 ilDatabaseUpdateStepExecutionLog::class => $execution_log,
96 Environment::RESOURCE_DATABASE => $db
99 $db->expects($this->exactly(3))
102 $this->objective->achieve($env);
104 $this->assertSame([1,2,4], $this->steps->called);
113 public function started(
string $class,
int $step):
void
115 $this->test->steps->called[] = [
"started", $class, $step];
117 public function finished(
string $class,
int $step):
void
119 $this->test->steps->called[] = [
"finished", $class, $step];
121 public function getLastStartedStep(
string $class):
int
125 public function getLastFinishedStep(
string $class):
int
132 $db = $this->createMock(ilDBInterface::class);
134 ilDBStepReader::class => $steps_reader,
135 ilDatabaseUpdateStepExecutionLog::class => $execution_log,
136 Environment::RESOURCE_DATABASE => $db
139 $this->objective->achieve($env);
142 [
"started", Test_ilDatabaseUpdateSteps::class, 1],
144 [
"finished", Test_ilDatabaseUpdateSteps::class, 1],
145 [
"started", Test_ilDatabaseUpdateSteps::class, 2],
147 [
"finished", Test_ilDatabaseUpdateSteps::class, 2],
148 [
"started", Test_ilDatabaseUpdateSteps::class, 4],
150 [
"finished", Test_ilDatabaseUpdateSteps::class, 4]
153 $this->assertSame($expected, $this->steps->called);
159 public function started(
string $class,
int $step):
void
162 public function finished(
string $class,
int $step):
void
165 public function getLastStartedStep(
string $class):
int
169 public function getLastFinishedStep(
string $class):
int
176 $db = $this->createMock(ilDBInterface::class);
178 ilDBStepReader::class => $steps_reader,
179 ilDatabaseUpdateStepExecutionLog::class => $execution_log,
180 Environment::RESOURCE_DATABASE => $db
183 $db->expects($this->exactly(2))
186 $this->objective->achieve($env);
188 $this->assertSame([2,4], $this->steps->called);
193 $this->expectException(RuntimeException::class);
196 public function started(
string $class,
int $step):
void
199 public function finished(
string $class,
int $step):
void
202 public function getLastStartedStep(
string $class):
int
206 public function getLastFinishedStep(
string $class):
int
211 $db = $this->createMock(ilDBInterface::class);
213 ilDatabaseUpdateStepExecutionLog::class => $execution_log,
214 Environment::RESOURCE_DATABASE => $db
216 $this->objective->achieve($env);
prepare(ilDBInterface $db)
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 logs the execution of database update steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc