]> BookStack Code Mirror - bookstack/blob - tests/Commands/ClearActivityCommandTest.php
Split command tests out to indavidual test files
[bookstack] / tests / Commands / ClearActivityCommandTest.php
1 <?php namespace Tests\Commands;
2
3 use BookStack\Actions\ActivityType;
4 use BookStack\Entities\Models\Page;
5 use Tests\TestCase;
6
7 class ClearActivityCommandTest extends TestCase
8 {
9     public function test_clear_activity_command()
10     {
11         $this->asEditor();
12         $page = Page::first();
13         \Activity::addForEntity($page, ActivityType::PAGE_UPDATE);
14
15         $this->assertDatabaseHas('activities', [
16             'type' => 'page_update',
17             'entity_id' => $page->id,
18             'user_id' => $this->getEditor()->id
19         ]);
20
21         $exitCode = \Artisan::call('bookstack:clear-activity');
22         $this->assertTrue($exitCode === 0, 'Command executed successfully');
23
24
25         $this->assertDatabaseMissing('activities', [
26             'type' => 'page_update'
27         ]);
28     }
29 }