public function testIsUpdateInProgress()
 {
     $status = new \Magento\Update\Status($this->tmpStatusFilePath, $this->tmpStatusLogFilePath, $this->updateInProgressFlagFilePath);
     $this->assertFalse($status->isUpdateInProgress());
     $this->assertInstanceOf('Magento\\Update\\Status', $status->setUpdateInProgress());
     $this->assertTrue($status->isUpdateInProgress());
     $this->assertInstanceOf('Magento\\Update\\Status', $status->setUpdateInProgress(false));
     $this->assertFalse($status->isUpdateInProgress());
     $this->assertInstanceOf('Magento\\Update\\Status', $status->setUpdateInProgress(true));
     $this->assertTrue($status->isUpdateInProgress());
 }
if ($status->isUpdateInProgress()) {
    exit('Cron is already in progress...');
}
if ($status->isUpdateError()) {
    exit('There was an error in previous Updater jobs...');
}
$backupDirectory = BACKUP_DIR;
if (!file_exists($backupDirectory)) {
    if (!mkdir($backupDirectory)) {
        $status->add(sprintf('Backup directory "%s" cannot be created.', $backupDirectory));
        exit;
    }
    chmod($backupDirectory, 0770);
}
try {
    $status->setUpdateInProgress();
} catch (\RuntimeException $e) {
    $status->add($e->getMessage());
    exit;
}
$jobQueue = new \Magento\Update\Queue();
try {
    while (!empty($jobQueue->peek()) && strpos($jobQueue->peek()[\Magento\Update\Queue::KEY_JOB_NAME], 'setup:') === false) {
        $job = $jobQueue->popQueuedJob();
        $status->add(sprintf('Job "%s" has been started', $job));
        try {
            $job->execute();
            $status->add(sprintf('Job "%s" has successfully completed', $job));
        } catch (\Exception $e) {
            $status->setUpdateError();
            $status->add(sprintf('An error occurred while executing job "%s": %s', $job, $e->getMessage()));