public function setUpPreliminarySuccess()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
     $this->readinessCheck->expects($this->once())->method('runReadinessCheck')->willReturn(true);
     $this->status->expects($this->once())->method('isUpdateInProgress')->willReturn(false);
     $this->status->expects($this->once())->method('isUpdateError')->willReturn(false);
     $this->status->expects($this->exactly(2))->method('toggleUpdateInProgress');
 }
 public function testRunReadinessCheckLastTimestamp()
 {
     $this->dbValidator->expects($this->once())->method('checkDatabaseConnection')->willReturn(true);
     $this->write->expects($this->once())->method('isExist')->willReturn(true);
     $this->write->expects($this->once())->method('readFile')->willReturn('{"current_timestamp": 50}');
     $expected = [ReadinessCheck::KEY_READINESS_CHECKS => [ReadinessCheck::KEY_DB_WRITE_PERMISSION_VERIFIED => true], ReadinessCheck::KEY_PHP_CHECKS => $this->expected, ReadinessCheck::KEY_LAST_TIMESTAMP => 50, ReadinessCheck::KEY_CURRENT_TIMESTAMP => 100];
     $expectedJson = json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     $this->write->expects($this->once())->method('writeFile')->with(ReadinessCheck::SETUP_CRON_JOB_STATUS_FILE, $expectedJson);
     $this->readinessCheck->runReadinessCheck();
 }
 /**
  * Check if Cron job can be run
  *
  * @return bool
  */
 private function checkRun()
 {
     return $this->deploymentConfig->isAvailable() && $this->readinessCheck->runReadinessCheck() && !$this->status->isUpdateInProgress() && !$this->status->isUpdateError();
 }
 /**
  * Check if Cron job can be run
  *
  * @return bool
  */
 private function checkRun()
 {
     return $this->readinessCheck->runReadinessCheck() && !$this->status->isUpdateInProgress() && !$this->status->isUpdateError();
 }