Example #1
0
 public function testItLogsInfoIfAllMigrationsWereSuccessfullyExecuted()
 {
     $this->migrator->expects($this->once())->method('needsToRun')->willReturn(true);
     $this->migrator->expects($this->once())->method('migrate')->willReturn(42);
     $this->mutex->expects($this->once())->method('acquire')->willReturn(true);
     $this->mutex->expects($this->once())->method('release')->willReturn(true);
     $this->logger->expects($this->once())->method('info')->with($this->stringContains('42'));
     $mediator = new Mediator($this->migrator, $this->mutex, $this->logger);
     $mediator->negotiate();
 }
Example #2
0
 /**
  * Executes migrations
  *
  * @return void
  */
 private function executeMigrations()
 {
     if ($this->migrator->needsToRun()) {
         $latestVersion = $this->migrator->migrate();
         $this->logger->info('Migrate all migrations up to version ' . $latestVersion . '.');
     }
 }