Skip to content

Commit

Permalink
added testCanNestedPerms test
Browse files Browse the repository at this point in the history
test to check multi level permissions properly
  • Loading branch information
bgeneto authored Nov 9, 2024
1 parent 9eeed0c commit d7f42f9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Authorization/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,19 @@ public function testCan(): void
$this->assertTrue($group2->can('users.edit'));
$this->assertFalse($group2->can('foo.bar'));
}

public function testCanNestedPerms(): void
{
$group = $this->groups->info('user');
$group->addPermission('foo.bar.*');
$group->addPermission('foo.biz.buz.*');
$this->assertTrue($group->can('foo.bar'));
$this->assertTrue($group->can('foo.bar.baz'));
$this->assertTrue($group->can('foo.bar.buz'));
$this->assertTrue($group->can('foo.bar.*'));
$this->assertTrue($group->can('foo.biz.buz'));
$this->assertFalse($group->can('foo.biz.*'));
$this->assertTrue($group->can('foo.biz.buz.bar'));
$this->assertFalse($group->can('foo.biz.bar.buz'));
}
}

0 comments on commit d7f42f9

Please sign in to comment.