entities->page(); $editor = $this->users->editor(); $role = $editor->roles()->first(); $this->permissions->addEntityPermission($page, ['view'], $role); JointPermission::query()->truncate(); $this->assertDatabaseMissing('joint_permissions', ['entity_id' => $page->id]); $exitCode = Artisan::call('bookstack:regenerate-permissions'); $this->assertTrue($exitCode === 0, 'Command executed successfully'); $this->assertDatabaseHas('joint_permissions', [ 'entity_id' => $page->id, 'entity_type' => 'page', 'role_id' => $role->id, 'has_permission' => 1, ]); $page->permissions()->delete(); $page->rebuildPermissions(); DB::beginTransaction(); } }