Skip to content

Commit

Permalink
Add null role permissions test for EloquentUser (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
rydurham authored and suwardany committed Sep 12, 2019
1 parent b85c26d commit 00dad15
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Users/EloquentUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,24 @@ public function it_can_pass_methods_to_permissions_instance()
$this->assertFalse($this->user->hasAccess('bar'));
}

/** @test */
public function it_will_ignore_empty_secondary_permissions()
{
$mockRole = m::mock(EloquentRole::class);
$mockRole->permissions = null;

$permissions = ['foo' => true, 'bar' => false];

$this->user->roles = [$mockRole];

$mockRole->shouldReceive('getPermissions')
->once()
->andReturn($permissions);

$this->assertTrue($this->user->hasAccess('foo'));
$this->assertFalse($this->user->hasAccess('bar'));
}

/** @test */
public function it_can_delete_a_user()
{
Expand Down

0 comments on commit 00dad15

Please sign in to comment.