mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-27 22:46:04 +00:00
Migration not changing version
This commit is contained in:
@@ -71,6 +71,13 @@ class Runner
|
||||
if ($afterSteps === []) {
|
||||
$io->writeLine("No migrations to run.");
|
||||
|
||||
if ($version !== $targetVersion) {
|
||||
$this->updateVersion($targetVersion);
|
||||
$this->dataManager->updateAppTimestamp();
|
||||
|
||||
$io->writeLine("Completed.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class RunnerTest extends TestCase
|
||||
$this->configWriter = $this->createMock(ConfigWriter::class);
|
||||
}
|
||||
|
||||
public function testRun(): void
|
||||
public function testRunMigration(): void
|
||||
{
|
||||
$this->versionDataProvider
|
||||
->expects($this->once())
|
||||
@@ -114,4 +114,78 @@ class RunnerTest extends TestCase
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$runner->run($this->io);
|
||||
}
|
||||
|
||||
public function testRunNoMigration(): void
|
||||
{
|
||||
$this->versionDataProvider
|
||||
->expects($this->once())
|
||||
->method('getTargetVersion')
|
||||
->willReturn('9.3.4');
|
||||
|
||||
$this->versionDataProvider
|
||||
->expects($this->once())
|
||||
->method('getPreviousVersion')
|
||||
->willReturn('9.2.7');
|
||||
|
||||
|
||||
$this->stepsRunner
|
||||
->expects($this->never())
|
||||
->method('runPrepare');
|
||||
|
||||
$this->stepsRunner
|
||||
->expects($this->never())
|
||||
->method('runAfterUpgrade');
|
||||
|
||||
$this->configWriter
|
||||
->expects($this->once())
|
||||
->method('set')
|
||||
->with('version', '9.3.4');
|
||||
|
||||
$runner = new Runner(
|
||||
$this->stepsProvider,
|
||||
$this->versionDataProvider,
|
||||
$this->stepsRunner,
|
||||
$this->dataManager,
|
||||
$this->configWriter
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$runner->run($this->io);
|
||||
}
|
||||
|
||||
public function testRunSameVersion(): void
|
||||
{
|
||||
$this->versionDataProvider
|
||||
->expects($this->once())
|
||||
->method('getTargetVersion')
|
||||
->willReturn('9.3.4');
|
||||
|
||||
$this->versionDataProvider
|
||||
->expects($this->once())
|
||||
->method('getPreviousVersion')
|
||||
->willReturn('9.3.4');
|
||||
|
||||
$this->stepsRunner
|
||||
->expects($this->never())
|
||||
->method('runPrepare');
|
||||
|
||||
$this->stepsRunner
|
||||
->expects($this->never())
|
||||
->method('runAfterUpgrade');
|
||||
|
||||
$this->configWriter
|
||||
->expects($this->never())
|
||||
->method('set');
|
||||
|
||||
$runner = new Runner(
|
||||
$this->stepsProvider,
|
||||
$this->versionDataProvider,
|
||||
$this->stepsRunner,
|
||||
$this->dataManager,
|
||||
$this->configWriter
|
||||
);
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$runner->run($this->io);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user