Пример #1
0
    /**
     * @NoCSRFRequired
     * @return DataResponse
     */
    public function getFailedIntegrityCheckFiles()
    {
        if (!$this->checker->isCodeCheckEnforced()) {
            return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.');
        }
        $completeResults = $this->checker->getResults();
        if (!empty($completeResults)) {
            $formattedTextResponse = 'Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
';
            foreach ($completeResults as $context => $contextResult) {
                $formattedTextResponse .= "- {$context}\n";
                foreach ($contextResult as $category => $result) {
                    $formattedTextResponse .= "\t- {$category}\n";
                    if ($category !== 'EXCEPTION') {
                        foreach ($result as $key => $results) {
                            $formattedTextResponse .= "\t\t- {$key}\n";
                        }
                    } else {
                        foreach ($result as $key => $results) {
                            $formattedTextResponse .= "\t\t- {$results}\n";
                        }
                    }
                }
            }
            $formattedTextResponse .= '
Raw output
==========
';
            $formattedTextResponse .= print_r($completeResults, true);
        } else {
            $formattedTextResponse = 'No errors have been found.';
        }
        $response = new DataDisplayResponse($formattedTextResponse, Http::STATUS_OK, ['Content-Type' => 'text/plain']);
        return $response;
    }
Пример #2
0
 /**
  * @param string $channel
  * @param bool $isCodeSigningEnforced
  * @dataProvider channelDataProvider
  */
 public function testIsCodeCheckEnforced($channel, $isCodeSigningEnforced)
 {
     $this->environmentHelper->expects($this->once())->method('getChannel')->will($this->returnValue($channel));
     $this->config->expects($this->any())->method('getSystemValue')->with('integrity.check.disabled', false)->will($this->returnValue(false));
     $this->assertSame($isCodeSigningEnforced, $this->checker->isCodeCheckEnforced());
 }