Skip to content

Commit

Permalink
fix(test): adjust ACLStorageWrapperTest to 26 fix
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Feb 10, 2023
1 parent 4daa46b commit a40379b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/Unit/ACL/ACLStorageWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use OC\Files\Storage\Temporary;
use OCA\Collectives\ACL\ACLStorageWrapper;
use OCA\Collectives\ACL\ACLStorageWrapper25;
use OCA\Collectives\ACL\ACLStorageWrapper26;
use OCP\Constants;
use OCP\Files\Storage\IStorage;
use OCP\IDBConnection;
Expand All @@ -27,7 +29,7 @@ protected function setUp(): void {
public function testNoReadImpliesNothing(): void {
$this->source->mkdir('foo');

$storage = new ACLStorageWrapper([
$storage = $this->createStorage([
'storage' => $this->source,
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_READ,
'in_share' => false,
Expand All @@ -42,7 +44,7 @@ public function testNoReadImpliesNothing(): void {
public function testInShareWithoutSharingPermissions(): void {
$this->source->mkdir('foo');

$storage = new ACLStorageWrapper([
$storage = $this->createStorage([
'storage' => $this->source,
'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE,
'in_share' => true,
Expand All @@ -56,7 +58,7 @@ public function testMove(): void {
$this->source->mkdir('foo');
$this->source->touch('file1');

$storage = new ACLStorageWrapper([
$storage = $this->createStorage([
'storage' => $this->source,
'permissions' => Constants::PERMISSION_READ,
'in_share' => false,
Expand All @@ -65,12 +67,22 @@ public function testMove(): void {
$this->assertFalse($storage->rename('file1', 'foo/file1'));


$storage = new ACLStorageWrapper([
$storage = $this->createStorage([
'storage' => $this->source,
'permissions' => Constants::PERMISSION_ALL,
'in_share' => false,
]);

$this->assertTrue($storage->rename('file1', 'foo/file1'));
}

private function createStorage($options): ACLStorageWrapper {
[$major, $minor, $micro] = \OCP\Util::getVersion();
if ($major >= 26) {
/** @psalm-suppress UndefinedClass */
return new ACLStorageWrapper26($options);
} else {
return new ACLStorageWrapper25($options);
}
}
}

0 comments on commit a40379b

Please sign in to comment.