]> BookStack Code Mirror - bookstack/blob - tests/Commands/RegeneratePermissionsCommandTest.php
Updated markdown editor to use svg drawio images
[bookstack] / tests / Commands / RegeneratePermissionsCommandTest.php
1 <?php
2
3 namespace Tests\Commands;
4
5 use BookStack\Auth\Permissions\JointPermission;
6 use BookStack\Entities\Models\Page;
7 use Illuminate\Support\Facades\DB;
8 use Tests\TestCase;
9
10 class RegeneratePermissionsCommandTest extends TestCase
11 {
12     public function test_regen_permissions_command()
13     {
14         \DB::rollBack();
15         JointPermission::query()->truncate();
16         $page = Page::first();
17
18         $this->assertDatabaseMissing('joint_permissions', ['entity_id' => $page->id]);
19
20         $exitCode = \Artisan::call('bookstack:regenerate-permissions');
21         $this->assertTrue($exitCode === 0, 'Command executed successfully');
22         DB::beginTransaction();
23
24         $this->assertDatabaseHas('joint_permissions', ['entity_id' => $page->id]);
25     }
26 }