From ad80cedd7ad74d7956ef4bd2974b1db58853b3d8 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 4 Apr 2025 16:21:21 +0300 Subject: [PATCH 1/2] Adapt to Yii RBAC 2.1, improve rector CI --- .github/workflows/rector.yml | 5 +++- CHANGELOG.md | 2 +- composer.json | 6 ++-- rector.php | 23 +++++--------- ...mentsStorageWithConcurrencyHandledTest.php | 8 ++--- ...nmentsStorageWithConcurrencyNotHandled.php | 8 ++--- ...ItemsStorageWithConcurrencyHandledTest.php | 30 +++++++++---------- ...msStorageWithConcurrencyNotHandledTest.php | 30 +++++++++---------- 8 files changed, 54 insertions(+), 58 deletions(-) diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 6a2162d..f5da663 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -1,5 +1,5 @@ on: - pull_request: + pull_request_target: paths-ignore: - 'docs/**' - 'README.md' @@ -14,7 +14,10 @@ name: rector jobs: rector: uses: yiisoft/actions/.github/workflows/rector.yml@master + secrets: + token: ${{ secrets.YIISOFT_GITHUB_TOKEN }} with: + repository: ${{ github.event.pull_request.head.repo.full_name }} os: >- ['ubuntu-latest'] php: >- diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d22a40..98f307a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.0.1 under development -- no changes in this release. +- Enh #110: Bump `yiisoft/rbac` version to `^2.1` (@vjik) ## 2.0.0 March 07, 2024 diff --git a/composer.json b/composer.json index 0102906..b9d77ea 100644 --- a/composer.json +++ b/composer.json @@ -29,16 +29,16 @@ ], "require": { "php": "^8.1", - "yiisoft/rbac": "^2.0", + "yiisoft/rbac": "^2.1", "yiisoft/var-dumper": "^1.7" }, "require-dev": { "ext-uopz": "*", "maglnet/composer-require-checker": "^4.3", "phpunit/phpunit": "^10.5.2", - "rector/rector": "^2.0.2", + "psr/clock": "^1.0", + "rector/rector": "^2.0.11", "roave/infection-static-analysis-plugin": "^1.18", - "slope-it/clock-mock": "0.5.0", "spatie/phpunit-watcher": "^1.23", "vimeo/psalm": "^4.30|^5.17", "yiisoft/files": "^1.0" diff --git a/rector.php b/rector.php index f55daae..c2226bf 100644 --- a/rector.php +++ b/rector.php @@ -5,23 +5,16 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; -use Rector\Set\ValueObject\LevelSetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', - ]); - - // register a single rule - $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); - - // define sets of rules - $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, - ]); - - $rectorConfig->skip([ + ]) + ->withPhpSets(php80: true) + ->withRules([ + InlineConstructorDefaultToPropertyRector::class, + ]) + ->withSkip([ ClosureToArrowFunctionRector::class, ]); -}; diff --git a/tests/AssignmentsStorageWithConcurrencyHandledTest.php b/tests/AssignmentsStorageWithConcurrencyHandledTest.php index 1a4d059..96a5978 100644 --- a/tests/AssignmentsStorageWithConcurrencyHandledTest.php +++ b/tests/AssignmentsStorageWithConcurrencyHandledTest.php @@ -41,7 +41,7 @@ public function testGetByUserId(): void $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByUserId('john')); } - public function testGetByItemNames(): void + public function testGetByItemNames(array $itemNames, array $expectedAssignments): void { $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByItemNames(['Researcher'])); } @@ -51,21 +51,21 @@ public function testGet(): void $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->get(itemName: 'Researcher', userId: 'john')); } - public function testExists(): void + public function testExists(string $itemName, string $userId, bool $expectedExists): void { $this->assertFalse( $this->getEmptyConcurrentAssignmentsStorage()->exists(itemName: 'Researcher', userId: 'john'), ); } - public function testUserHasItem(): void + public function testUserHasItem(string $userId, array $itemNames, bool $expectedUserHasItem): void { $this->assertFalse( $this->getEmptyConcurrentAssignmentsStorage()->userHasItem(userId: 'john', itemNames: ['Researcher']), ); } - public function testFilterUserItemNames(): void + public function testFilterUserItemNames(string $userId, array $itemNames, array $expectedUserItemNames): void { $this->assertEmpty( $this->getEmptyConcurrentAssignmentsStorage()->filterUserItemNames( diff --git a/tests/AssignmentsStorageWithConcurrencyNotHandled.php b/tests/AssignmentsStorageWithConcurrencyNotHandled.php index 7e18063..5ef5bba 100644 --- a/tests/AssignmentsStorageWithConcurrencyNotHandled.php +++ b/tests/AssignmentsStorageWithConcurrencyNotHandled.php @@ -39,7 +39,7 @@ public function testGetByUserId(): void $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByUserId('john')); } - public function testGetByItemNames(): void + public function testGetByItemNames(array $itemNames, array $expectedAssignments): void { $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByItemNames(['Researcher'])); } @@ -49,21 +49,21 @@ public function testGet(): void $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->get(itemName: 'Researcher', userId: 'john')); } - public function testExists(): void + public function testExists(string $itemName, string $userId, bool $expectedExists): void { $this->assertTrue( $this->getEmptyConcurrentAssignmentsStorage()->exists(itemName: 'Researcher', userId: 'john'), ); } - public function testUserHasItem(): void + public function testUserHasItem(string $userId, array $itemNames, bool $expectedUserHasItem): void { $this->assertTrue( $this->getEmptyConcurrentAssignmentsStorage()->userHasItem(userId: 'john', itemNames: ['Researcher']), ); } - public function testFilterUserItemNames(): void + public function testFilterUserItemNames(string $userId, array $itemNames, array $expectedUserItemNames): void { $this->assertNotEmpty( $this->getEmptyConcurrentAssignmentsStorage()->filterUserItemNames( diff --git a/tests/ItemsStorageWithConcurrencyHandledTest.php b/tests/ItemsStorageWithConcurrencyHandledTest.php index 900ae5f..881b6a2 100644 --- a/tests/ItemsStorageWithConcurrencyHandledTest.php +++ b/tests/ItemsStorageWithConcurrencyHandledTest.php @@ -34,7 +34,7 @@ public function testGetAll(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAll()); } - public function testGetByNames(): void + public function testGetByNames(array $names, array $expectedItemNames): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getByNames(['posts.view'])); } @@ -44,12 +44,12 @@ public function testGet(): void $this->assertNull($this->getEmptyConcurrentItemsStorage()->get('posts.view')); } - public function testExists(): void + public function testExists(string $name, bool $expectedExists): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->exists('posts.view')); } - public function testRoleExists(): void + public function testRoleExists(string $name, bool $expectedRoleExists): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->roleExists('posts.viewer')); } @@ -68,7 +68,7 @@ public function testAddWithCurrentTimestamps(): void $this->assertCount($count + 2, $innerTestStorage->getAll()); } - public function testUpdate(): void + public function testUpdate(string $itemName, string $parentNameForChildrenCheck, bool $expectedHasChildren): void { $innerTestStorage = new ItemsStorage($this->getItemsStorageFilePath()); $testStorage = new ConcurrentItemsStorageDecorator($innerTestStorage); @@ -83,7 +83,7 @@ public function testUpdate(): void $this->assertTrue($innerTestStorage->exists('posts.create1')); } - public function testRemove(): void + public function testRemove(string $name): void { $innerTestStorage = new ItemsStorage($this->getItemsStorageFilePath()); $testStorage = new ConcurrentItemsStorageDecorator($innerTestStorage); @@ -102,7 +102,7 @@ public function testGetRoles(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getRoles()); } - public function testGetRolesByNames(): void + public function testGetRolesByNames(array $names, array $expectedRoleNames): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getRolesByNames(['posts.viewer'])); } @@ -133,7 +133,7 @@ public function testGetPermissions(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getPermissions()); } - public function testGetPermissionsByNames(): void + public function testGetPermissionsByNames(array $names, array $expectedPermissionNames): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getPermissionsByNames(['posts.view'])); } @@ -159,32 +159,32 @@ public function testClearPermissions(): void $this->assertContainsOnlyInstancesOf(Role::class, $all); } - public function testGetParents(): void + public function testGetParents(string $childName, array $expectedParents): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getParents('posts.view')); } - public function testGetHierarchy(): void + public function testGetHierarchy(string $name, array $expectedHierarchy): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getHierarchy('posts.view')); } - public function testGetDirectChildren(): void + public function testGetDirectChildren(string $parentName, array $expectedChildren): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getDirectChildren('posts.viewer')); } - public function testGetAllChildren(): void + public function testGetAllChildren(string|array $parentNames, array $expectedChildren): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildren('posts.viewer')); } - public function testGetAllChildRoles(): void + public function testGetAllChildRoles(string|array $parentNames, array $expectedChildren): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildRoles('posts.redactor')); } - public function testGetAllChildPermissions(): void + public function testGetAllChildPermissions(string|array $parentNames, array $expectedChildren): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildPermissions('posts.viewer')); } @@ -194,12 +194,12 @@ public function testHasChildren(): void $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasChildren('posts.viewer')); } - public function testHasChild(): void + public function testHasChild(string $parentName, string $childName, bool $expectedHasChild): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasChild('posts.viewer', 'posts.view')); } - public function testHasDirectChild(): void + public function testHasDirectChild(string $parentName, string $childName, bool $expectedHasDirectChild): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasDirectChild('posts.viewer', 'posts.view')); } diff --git a/tests/ItemsStorageWithConcurrencyNotHandledTest.php b/tests/ItemsStorageWithConcurrencyNotHandledTest.php index 33ca0d4..a458501 100644 --- a/tests/ItemsStorageWithConcurrencyNotHandledTest.php +++ b/tests/ItemsStorageWithConcurrencyNotHandledTest.php @@ -38,7 +38,7 @@ public function testGetAll(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAll()); } - public function testGetByNames(): void + public function testGetByNames(array $names, array $expectedItemNames): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getByNames(['posts.view'])); } @@ -48,12 +48,12 @@ public function testGet(): void $this->assertNotNull($this->getEmptyConcurrentItemsStorage()->get('posts.view')); } - public function testExists(): void + public function testExists(string $name, bool $expectedExists): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->exists('posts.view')); } - public function testRoleExists(): void + public function testRoleExists(string $name, bool $expectedRoleExists): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->roleExists('posts.viewer')); } @@ -76,7 +76,7 @@ public function testAddWithPastTimestamps(): void $this->markTestSkipped(); } - public function testUpdate(): void + public function testUpdate(string $itemName, string $parentNameForChildrenCheck, bool $expectedHasChildren): void { $testStorage = new ItemsStorage($this->getItemsStorageFilePath()); $actionStorage = $this->getItemsStorage(); @@ -90,7 +90,7 @@ public function testUpdate(): void $this->assertFalse($testStorage->exists('posts.create1')); } - public function testRemove(): void + public function testRemove(string $name): void { $testStorage = new ItemsStorage($this->getItemsStorageFilePath()); $actionStorage = $this->getItemsStorage(); @@ -108,7 +108,7 @@ public function testGetRoles(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getRoles()); } - public function testGetRolesByNames(): void + public function testGetRolesByNames(array $names, array $expectedRoleNames): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getRolesByNames(['posts.viewer'])); } @@ -138,7 +138,7 @@ public function testGetPermissions(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getPermissions()); } - public function testGetPermissionsByNames(): void + public function testGetPermissionsByNames(array $names, array $expectedPermissionNames): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getPermissionsByNames(['posts.view'])); } @@ -163,32 +163,32 @@ public function testClearPermissions(): void $this->assertContainsOnlyInstancesOf(Role::class, $all); } - public function testGetParents(): void + public function testGetParents(string $childName, array $expectedParents): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getParents('posts.view')); } - public function testGetHierarchy(): void + public function testGetHierarchy(string $name, array $expectedHierarchy): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getHierarchy('posts.view')); } - public function testGetDirectChildren(): void + public function testGetDirectChildren(string $parentName, array $expectedChildren): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getDirectChildren('posts.viewer')); } - public function testGetAllChildren(): void + public function testGetAllChildren(string|array $parentNames, array $expectedChildren): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildren('posts.viewer')); } - public function testGetAllChildRoles(): void + public function testGetAllChildRoles(string|array $parentNames, array $expectedChildren): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildRoles('posts.redactor')); } - public function testGetAllChildPermissions(): void + public function testGetAllChildPermissions(string|array $parentNames, array $expectedChildren): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildPermissions('posts.viewer')); } @@ -198,12 +198,12 @@ public function testHasChildren(): void $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasChildren('posts.viewer')); } - public function testHasChild(): void + public function testHasChild(string $parentName, string $childName, bool $expectedHasChild): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasChild('posts.viewer', 'posts.view')); } - public function testHasDirectChild(): void + public function testHasDirectChild(string $parentName, string $childName, bool $expectedHasDirectChild): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasDirectChild('posts.viewer', 'posts.view')); } From 6c974f8cf337ee68bc0ea1f939748133674ff4ad Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 4 Apr 2025 16:25:51 +0300 Subject: [PATCH 2/2] fix --- rector.php | 2 ++ ...mentsStorageWithConcurrencyHandledTest.php | 8 ++--- ...nmentsStorageWithConcurrencyNotHandled.php | 8 ++--- ...ItemsStorageWithConcurrencyHandledTest.php | 30 +++++++++---------- ...msStorageWithConcurrencyNotHandledTest.php | 30 +++++++++---------- 5 files changed, 40 insertions(+), 38 deletions(-) diff --git a/rector.php b/rector.php index c2226bf..c5adbf1 100644 --- a/rector.php +++ b/rector.php @@ -5,6 +5,7 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; +use Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector; return RectorConfig::configure() ->withPaths([ @@ -17,4 +18,5 @@ ]) ->withSkip([ ClosureToArrowFunctionRector::class, + AddParamBasedOnParentClassMethodRector::class, ]); diff --git a/tests/AssignmentsStorageWithConcurrencyHandledTest.php b/tests/AssignmentsStorageWithConcurrencyHandledTest.php index 96a5978..1a4d059 100644 --- a/tests/AssignmentsStorageWithConcurrencyHandledTest.php +++ b/tests/AssignmentsStorageWithConcurrencyHandledTest.php @@ -41,7 +41,7 @@ public function testGetByUserId(): void $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByUserId('john')); } - public function testGetByItemNames(array $itemNames, array $expectedAssignments): void + public function testGetByItemNames(): void { $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByItemNames(['Researcher'])); } @@ -51,21 +51,21 @@ public function testGet(): void $this->assertEmpty($this->getEmptyConcurrentAssignmentsStorage()->get(itemName: 'Researcher', userId: 'john')); } - public function testExists(string $itemName, string $userId, bool $expectedExists): void + public function testExists(): void { $this->assertFalse( $this->getEmptyConcurrentAssignmentsStorage()->exists(itemName: 'Researcher', userId: 'john'), ); } - public function testUserHasItem(string $userId, array $itemNames, bool $expectedUserHasItem): void + public function testUserHasItem(): void { $this->assertFalse( $this->getEmptyConcurrentAssignmentsStorage()->userHasItem(userId: 'john', itemNames: ['Researcher']), ); } - public function testFilterUserItemNames(string $userId, array $itemNames, array $expectedUserItemNames): void + public function testFilterUserItemNames(): void { $this->assertEmpty( $this->getEmptyConcurrentAssignmentsStorage()->filterUserItemNames( diff --git a/tests/AssignmentsStorageWithConcurrencyNotHandled.php b/tests/AssignmentsStorageWithConcurrencyNotHandled.php index 5ef5bba..7e18063 100644 --- a/tests/AssignmentsStorageWithConcurrencyNotHandled.php +++ b/tests/AssignmentsStorageWithConcurrencyNotHandled.php @@ -39,7 +39,7 @@ public function testGetByUserId(): void $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByUserId('john')); } - public function testGetByItemNames(array $itemNames, array $expectedAssignments): void + public function testGetByItemNames(): void { $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->getByItemNames(['Researcher'])); } @@ -49,21 +49,21 @@ public function testGet(): void $this->assertNotEmpty($this->getEmptyConcurrentAssignmentsStorage()->get(itemName: 'Researcher', userId: 'john')); } - public function testExists(string $itemName, string $userId, bool $expectedExists): void + public function testExists(): void { $this->assertTrue( $this->getEmptyConcurrentAssignmentsStorage()->exists(itemName: 'Researcher', userId: 'john'), ); } - public function testUserHasItem(string $userId, array $itemNames, bool $expectedUserHasItem): void + public function testUserHasItem(): void { $this->assertTrue( $this->getEmptyConcurrentAssignmentsStorage()->userHasItem(userId: 'john', itemNames: ['Researcher']), ); } - public function testFilterUserItemNames(string $userId, array $itemNames, array $expectedUserItemNames): void + public function testFilterUserItemNames(): void { $this->assertNotEmpty( $this->getEmptyConcurrentAssignmentsStorage()->filterUserItemNames( diff --git a/tests/ItemsStorageWithConcurrencyHandledTest.php b/tests/ItemsStorageWithConcurrencyHandledTest.php index 881b6a2..900ae5f 100644 --- a/tests/ItemsStorageWithConcurrencyHandledTest.php +++ b/tests/ItemsStorageWithConcurrencyHandledTest.php @@ -34,7 +34,7 @@ public function testGetAll(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAll()); } - public function testGetByNames(array $names, array $expectedItemNames): void + public function testGetByNames(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getByNames(['posts.view'])); } @@ -44,12 +44,12 @@ public function testGet(): void $this->assertNull($this->getEmptyConcurrentItemsStorage()->get('posts.view')); } - public function testExists(string $name, bool $expectedExists): void + public function testExists(): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->exists('posts.view')); } - public function testRoleExists(string $name, bool $expectedRoleExists): void + public function testRoleExists(): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->roleExists('posts.viewer')); } @@ -68,7 +68,7 @@ public function testAddWithCurrentTimestamps(): void $this->assertCount($count + 2, $innerTestStorage->getAll()); } - public function testUpdate(string $itemName, string $parentNameForChildrenCheck, bool $expectedHasChildren): void + public function testUpdate(): void { $innerTestStorage = new ItemsStorage($this->getItemsStorageFilePath()); $testStorage = new ConcurrentItemsStorageDecorator($innerTestStorage); @@ -83,7 +83,7 @@ public function testUpdate(string $itemName, string $parentNameForChildrenCheck, $this->assertTrue($innerTestStorage->exists('posts.create1')); } - public function testRemove(string $name): void + public function testRemove(): void { $innerTestStorage = new ItemsStorage($this->getItemsStorageFilePath()); $testStorage = new ConcurrentItemsStorageDecorator($innerTestStorage); @@ -102,7 +102,7 @@ public function testGetRoles(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getRoles()); } - public function testGetRolesByNames(array $names, array $expectedRoleNames): void + public function testGetRolesByNames(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getRolesByNames(['posts.viewer'])); } @@ -133,7 +133,7 @@ public function testGetPermissions(): void $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getPermissions()); } - public function testGetPermissionsByNames(array $names, array $expectedPermissionNames): void + public function testGetPermissionsByNames(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getPermissionsByNames(['posts.view'])); } @@ -159,32 +159,32 @@ public function testClearPermissions(): void $this->assertContainsOnlyInstancesOf(Role::class, $all); } - public function testGetParents(string $childName, array $expectedParents): void + public function testGetParents(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getParents('posts.view')); } - public function testGetHierarchy(string $name, array $expectedHierarchy): void + public function testGetHierarchy(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getHierarchy('posts.view')); } - public function testGetDirectChildren(string $parentName, array $expectedChildren): void + public function testGetDirectChildren(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getDirectChildren('posts.viewer')); } - public function testGetAllChildren(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildren(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildren('posts.viewer')); } - public function testGetAllChildRoles(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildRoles(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildRoles('posts.redactor')); } - public function testGetAllChildPermissions(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildPermissions(): void { $this->assertEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildPermissions('posts.viewer')); } @@ -194,12 +194,12 @@ public function testHasChildren(): void $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasChildren('posts.viewer')); } - public function testHasChild(string $parentName, string $childName, bool $expectedHasChild): void + public function testHasChild(): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasChild('posts.viewer', 'posts.view')); } - public function testHasDirectChild(string $parentName, string $childName, bool $expectedHasDirectChild): void + public function testHasDirectChild(): void { $this->assertFalse($this->getEmptyConcurrentItemsStorage()->hasDirectChild('posts.viewer', 'posts.view')); } diff --git a/tests/ItemsStorageWithConcurrencyNotHandledTest.php b/tests/ItemsStorageWithConcurrencyNotHandledTest.php index a458501..33ca0d4 100644 --- a/tests/ItemsStorageWithConcurrencyNotHandledTest.php +++ b/tests/ItemsStorageWithConcurrencyNotHandledTest.php @@ -38,7 +38,7 @@ public function testGetAll(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAll()); } - public function testGetByNames(array $names, array $expectedItemNames): void + public function testGetByNames(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getByNames(['posts.view'])); } @@ -48,12 +48,12 @@ public function testGet(): void $this->assertNotNull($this->getEmptyConcurrentItemsStorage()->get('posts.view')); } - public function testExists(string $name, bool $expectedExists): void + public function testExists(): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->exists('posts.view')); } - public function testRoleExists(string $name, bool $expectedRoleExists): void + public function testRoleExists(): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->roleExists('posts.viewer')); } @@ -76,7 +76,7 @@ public function testAddWithPastTimestamps(): void $this->markTestSkipped(); } - public function testUpdate(string $itemName, string $parentNameForChildrenCheck, bool $expectedHasChildren): void + public function testUpdate(): void { $testStorage = new ItemsStorage($this->getItemsStorageFilePath()); $actionStorage = $this->getItemsStorage(); @@ -90,7 +90,7 @@ public function testUpdate(string $itemName, string $parentNameForChildrenCheck, $this->assertFalse($testStorage->exists('posts.create1')); } - public function testRemove(string $name): void + public function testRemove(): void { $testStorage = new ItemsStorage($this->getItemsStorageFilePath()); $actionStorage = $this->getItemsStorage(); @@ -108,7 +108,7 @@ public function testGetRoles(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getRoles()); } - public function testGetRolesByNames(array $names, array $expectedRoleNames): void + public function testGetRolesByNames(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getRolesByNames(['posts.viewer'])); } @@ -138,7 +138,7 @@ public function testGetPermissions(): void $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getPermissions()); } - public function testGetPermissionsByNames(array $names, array $expectedPermissionNames): void + public function testGetPermissionsByNames(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getPermissionsByNames(['posts.view'])); } @@ -163,32 +163,32 @@ public function testClearPermissions(): void $this->assertContainsOnlyInstancesOf(Role::class, $all); } - public function testGetParents(string $childName, array $expectedParents): void + public function testGetParents(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getParents('posts.view')); } - public function testGetHierarchy(string $name, array $expectedHierarchy): void + public function testGetHierarchy(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getHierarchy('posts.view')); } - public function testGetDirectChildren(string $parentName, array $expectedChildren): void + public function testGetDirectChildren(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getDirectChildren('posts.viewer')); } - public function testGetAllChildren(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildren(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildren('posts.viewer')); } - public function testGetAllChildRoles(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildRoles(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildRoles('posts.redactor')); } - public function testGetAllChildPermissions(string|array $parentNames, array $expectedChildren): void + public function testGetAllChildPermissions(): void { $this->assertNotEmpty($this->getEmptyConcurrentItemsStorage()->getAllChildPermissions('posts.viewer')); } @@ -198,12 +198,12 @@ public function testHasChildren(): void $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasChildren('posts.viewer')); } - public function testHasChild(string $parentName, string $childName, bool $expectedHasChild): void + public function testHasChild(): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasChild('posts.viewer', 'posts.view')); } - public function testHasDirectChild(string $parentName, string $childName, bool $expectedHasDirectChild): void + public function testHasDirectChild(): void { $this->assertTrue($this->getEmptyConcurrentItemsStorage()->hasDirectChild('posts.viewer', 'posts.view')); }