Skip to content

Commit

Permalink
Miscellaneous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Feb 16, 2024
1 parent 8b775e3 commit 85a2fa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ When using [Yii Console](https://github.com/yiisoft/yii-console), add this to `c
'yiisoft/db-migration' => [
// ...
'sourcePaths' => [
implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'vendor', 'yiisoft', 'rbac', 'migrations', 'items']),
implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'vendor', 'yiisoft', 'rbac', 'migrations', 'assignments']),
dirname(__DIR__) . '/vendor/yiisoft/rbac-db/migrations/items']),
dirname(__DIR__), '/vendor/yiisoft/rbac-db/migrations/assignments']),
],
],
```
Expand Down
22 changes: 7 additions & 15 deletions tests/Base/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
use Yiisoft\Rbac\AssignmentsStorageInterface;
use Yiisoft\Rbac\Db\TransactionalManagerDecorator;
use Yiisoft\Rbac\ItemsStorageInterface;
use Yiisoft\Rbac\Manager;
use Yiisoft\Rbac\ManagerInterface;
use Yiisoft\Rbac\RuleFactoryInterface;
use Yiisoft\Rbac\Tests\Common\ManagerConfigurationTestTrait;
use Yiisoft\Rbac\Tests\Support\SimpleRuleFactory;

abstract class ManagerTest extends TestCase
{
use ManagerConfigurationTestTrait;
use ManagerConfigurationTestTrait {
createManager as protected traitCreateManager;
}

protected function tearDown(): void
{
Expand All @@ -33,18 +32,11 @@ protected function populateDatabase(): void
protected function createManager(
?ItemsStorageInterface $itemsStorage = null,
?AssignmentsStorageInterface $assignmentsStorage = null,
?RuleFactoryInterface $ruleFactory = null,
?bool $enableDirectPermissions = false
): ManagerInterface {
$arguments = [
$itemsStorage ?? $this->createItemsStorage(),
$assignmentsStorage ?? $this->createAssignmentsStorage(),
$ruleFactory ?? new SimpleRuleFactory(),
];
if ($enableDirectPermissions !== null) {
$arguments[] = $enableDirectPermissions;
}

return new TransactionalManagerDecorator(new Manager(...$arguments), $this->getDatabase());
return new TransactionalManagerDecorator(
$this->traitCreateManager($itemsStorage, $assignmentsStorage, $enableDirectPermissions),
$this->getDatabase(),
);
}
}

0 comments on commit 85a2fa7

Please sign in to comment.