public function testCheckUpdater()
 {
     $json = [ReadinessCheck::KEY_READINESS_CHECKS => [CronScriptReadinessCheck::UPDATER_KEY_FILE_PERMISSIONS_VERIFIED => true], ReadinessCheck::KEY_CURRENT_TIMESTAMP => 200, ReadinessCheck::KEY_LAST_TIMESTAMP => 140];
     $this->read->expects($this->once())->method('readFile')->willReturn(json_encode($json));
     $expected = ['success' => true];
     $this->assertEquals($expected, $this->cronScriptReadinessCheck->checkUpdater());
 }
Ejemplo n.º 2
0
 public function testCronScriptActionBothNotice()
 {
     $this->cronScriptReadinessCheck->expects($this->once())->method('checkSetup')->willReturn(['success' => true, 'notice' => 'notice setup']);
     $this->cronScriptReadinessCheck->expects($this->once())->method('checkUpdater')->willReturn(['success' => true, 'notice' => 'notice updater']);
     $expected = new JsonModel(['responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS, 'setupNoticeMessage' => 'Notice from Setup Application Cron Script:<br/>notice setup', 'updaterNoticeMessage' => 'Notice from Updater Application Cron Script:<br/>notice updater']);
     $this->assertEquals($expected, $this->environment->cronScriptAction());
 }
Ejemplo n.º 3
0
    /**
     * Verifies Setup and Updater Cron status
     *
     * @return \Zend\View\Model\JsonModel
     */
    public function cronScriptAction()
    {
        $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;

        $setupCheck = $this->cronScriptReadinessCheck->checkSetup();
        $updaterCheck = $this->cronScriptReadinessCheck->checkUpdater();
        $data = [];
        if (!$setupCheck['success']) {
            $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
            $data['setupErrorMessage'] = 'Error from Setup Application Cron Script:<br/>' . $setupCheck['error'];
        }
        if (!$updaterCheck['success']) {
            $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
            $data['updaterErrorMessage'] = 'Error from Updater Application Cron Script:<br/>' . $updaterCheck['error'];

        }
        if (isset($setupCheck['notice'])) {
            $data['setupNoticeMessage'] = 'Notice from Setup Application Cron Script:<br/>' . $setupCheck['notice'];
        }
        if (isset($updaterCheck['notice'])) {
            $data['updaterNoticeMessage'] = 'Notice from Updater Application Cron Script:<br/>' .
                $updaterCheck['notice'];
        }
        $data['responseType'] = $responseType;
        return new \Zend\View\Model\JsonModel($data);
    }