Handle strict typing in Checker and fix tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-02-21 21:09:08 +01:00
parent 4d5f2e64a5
commit 72e745be26
No known key found for this signature in database
GPG key ID: F941078878347C0C
2 changed files with 9 additions and 1 deletions

View file

@ -333,7 +333,12 @@ class Checker {
return [];
}
$signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true);
$content = $this->fileAccessHelper->file_get_contents($signaturePath);
$signatureData = null;
if (\is_string($content)) {
$signatureData = json_decode($content, true);
}
if(!\is_array($signatureData)) {
throw new InvalidSignatureException('Signature data not found.');
}

View file

@ -58,6 +58,9 @@ class CheckerTest extends TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->config->method('getAppValue')
->will($this->returnArgument(2));
$this->cacheFactory
->expects($this->any())
->method('createDistributed')