Skip to content

Commit

Permalink
chore: optimize code
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf authored Jul 6, 2024
1 parent 5572c66 commit c9cce86
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions tests/ACL/ACLManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,14 @@
use Test\TestCase;

class ACLManagerTest extends TestCase {
/** @var RuleManager */
private $ruleManager;
/** @var TrashManager */
private $trashManager;
/** @var LoggerInterface */
private $logger;
/** @var IUser */
private $user;
/** @var ACLManager */
private $aclManager;
/** @var IUserMapping */
private $dummyMapping;
private RuleManager $ruleManager;
private TrashManager $trashManager;
private LoggerInterface $logger;
private IUser $user;
private ACLManager $aclManager;
private IUserMapping $dummyMapping;
/** @var Rule[] */
private $rules = [];
private array $rules = [];

protected function setUp(): void {
parent::setUp();
Expand Down Expand Up @@ -81,7 +75,7 @@ private function createMapping(string $id): IUserMapping {
return $mapping;
}

private function getAclManager(bool $perUserMerge = false) {
private function getAclManager(bool $perUserMerge = false): ACLManager {
$rootMountPoint = $this->createMock(IMountPoint::class);
$rootMountPoint->method('getNumericStorageId')
->willReturn(1);
Expand All @@ -94,12 +88,12 @@ private function getAclManager(bool $perUserMerge = false) {
}, null, $perUserMerge);
}

public function testGetACLPermissionsForPathNoRules() {
public function testGetACLPermissionsForPathNoRules(): void {
$this->rules = [];
$this->assertEquals(Constants::PERMISSION_ALL, $this->aclManager->getACLPermissionsForPath('foo'));
}

public function testGetACLPermissionsForPath() {
public function testGetACLPermissionsForPath(): void {
$this->rules = [
'foo' => [
new Rule($this->createMapping('1'), 10, Constants::PERMISSION_READ + Constants::PERMISSION_UPDATE, Constants::PERMISSION_READ), // read only
Expand All @@ -125,7 +119,7 @@ public function testGetACLPermissionsForPath() {
$this->assertEquals(Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE - Constants::PERMISSION_UPDATE - Constants::PERMISSION_READ, $this->aclManager->getACLPermissionsForPath('foo/blocked2'));
}

public function testGetACLPermissionsForPathInTrashbin() {
public function testGetACLPermissionsForPathInTrashbin(): void {
$this->rules = [
'__groupfolders/1' => [
new Rule($this->dummyMapping, 10, Constants::PERMISSION_READ + Constants::PERMISSION_UPDATE, Constants::PERMISSION_READ), // read only
Expand Down Expand Up @@ -155,7 +149,7 @@ public function testGetACLPermissionsForPathInTrashbin() {



public function testGetACLPermissionsForPathPerUserMerge() {
public function testGetACLPermissionsForPathPerUserMerge(): void {
$aclManager = $this->getAclManager(true);
$this->rules = [
'foo' => [
Expand Down

0 comments on commit c9cce86

Please sign in to comment.