Artesaos\Defender\Testing\EloquentPermissionRepositoryTest::testShouldAttachPermissionToRole PHP Method

testShouldAttachPermissionToRole() public method

Testing if permission is attached to role.
    public function testShouldAttachPermissionToRole()
    {
        $permission = $this->createPermission('users.index');
        $role = Role::where(['name' => 'admin'])->first();
        $permission->roles()->attach($role);
        $this->seePermissionAttachedToRoleInDatabase($permission, $role);
        $this->assertTrue($permission->roles()->get()->contains($role->id));
        $this->assertInstanceOf('Artesaos\\Defender\\Pivots\\PermissionRolePivot', $role->permissions->first()->pivot);
    }