/** * @param StepList $steps * @throws Exception * @return void */ private function runIntegrity(StepList $steps) { $result = true; foreach ($steps->getSteps() as $stepName => $step) { if (!empty($step['integrity'])) { $result = $this->runStage($step['integrity'], $stepName, 'integrity check') && $result; } } if (!$result) { throw new Exception('Integrity Check failed'); } }
public function testRunStepsWithSuccessProgress() { $stepIntegrity = $this->getMockBuilder('\\Migration\\App\\Step\\StageInterface')->getMock(); $stepIntegrity->expects($this->never())->method('perform'); $stepData = $this->getMockBuilder('\\Migration\\App\\Step\\StageInterface')->getMock(); $stepData->expects($this->never())->method('perform'); $stepVolume = $this->getMockBuilder('\\Migration\\App\\Step\\StageInterface')->getMock(); $stepVolume->expects($this->never())->method('perform'); $this->progress->expects($this->never())->method('saveResult'); $this->progress->expects($this->any())->method('isCompleted')->willReturn(true); $this->logger->expects($this->at(0))->method('info')->with("started"); $this->logger->expects($this->at(1))->method('info')->with("started"); $this->logger->expects($this->at(2))->method('info')->with("started"); $this->logger->expects($this->at(3))->method('info')->with("Migration completed"); $this->stepList->expects($this->any())->method('getSteps')->willReturn(['Title' => ['integrity' => $stepIntegrity, 'data' => $stepData, 'volume' => $stepVolume]]); $this->assertTrue($this->settings->run()); }