public function setUp() { $this->entity = new UsherUser(); $this->entity->setPermissions(['index' => true, 'show' => false, 'create' => true, 'edit' => false]); $this->role = new UsherRole(); $this->role->setPermissions(['index' => true, 'show' => false, 'create' => false, 'edit' => true, 'destroy' => true]); $this->entity->assignRole($this->role); }
public function test_can_check_if_has_access() { $this->entity->setPermissions(['dashboard.index' => true, 'dashboard.show' => false]); $this->assertTrue($this->entity->hasAccess('dashboard.index')); $this->assertFalse($this->entity->hasAccess('dashboard.show')); }