Skip to content

Commit

Permalink
Adjust Files/Storage/Wrapper/EncryptionTest.php to avoid array offset…
Browse files Browse the repository at this point in the history
… on value of type null
  • Loading branch information
phil-davis committed Apr 21, 2020
1 parent dd8d873 commit 8ed0f81
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/lib/Files/Storage/Wrapper/EncryptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,16 @@ function ($path) use ($encrypted) {
->method('getCache')
->with($path)
->willReturn($fileEntry);

if (isset($metaData['fileid'])) {
$fileId = $metaData['fileid'];
} else {
$fileId = null;
}

$fileEntry->expects($this->any())
->method('get')
->with($metaData['fileid']);
->with($fileId);

$this->instance->expects($this->any())->method('getCache')->willReturn($cache);
$this->instance->expects($this->any())->method('verifyUnencryptedSize')
Expand All @@ -295,7 +302,7 @@ function ($path) use ($encrypted) {
public function dataTestGetMetaData() {
return [
['/test.txt', ['size' => 42, 'encrypted' => 2, 'encryptedVersion' => 2, 'fileid' => 1], true, true, 12, ['size' => 12, 'encrypted' => true, 'encryptedVersion' => 2]],
['/test.txt', null, true, true, 12, null],
['/test.txt', [], true, true, 12, ['size' => 12]],
['/test.txt', ['size' => 42, 'encrypted' => 0, 'fileid' => 1], false, false, 12, ['size' => 42, 'encrypted' => false]],
['/test.txt', ['size' => 42, 'encrypted' => false, 'fileid' => 1], true, false, 12, ['size' => 12, 'encrypted' => true]]
];
Expand Down

0 comments on commit 8ed0f81

Please sign in to comment.