]> BookStack Code Mirror - bookstack/blob - tests/Commands/RegenerateCommentContentCommandTest.php
Merge branch 'prev-next-button' of https://github.com/shubhamosmosys/BookStack into...
[bookstack] / tests / Commands / RegenerateCommentContentCommandTest.php
1 <?php namespace Tests\Commands;
2
3 use BookStack\Actions\Comment;
4 use Tests\TestCase;
5
6 class RegenerateCommentContentCommandTest extends TestCase
7 {
8     public function test_regenerate_comment_content_command()
9     {
10         Comment::query()->forceCreate([
11             'html' => 'some_old_content',
12             'text' => 'some_fresh_content',
13         ]);
14
15         $this->assertDatabaseHas('comments', [
16             'html' => 'some_old_content',
17         ]);
18
19         $exitCode = \Artisan::call('bookstack:regenerate-comment-content');
20         $this->assertTrue($exitCode === 0, 'Command executed successfully');
21
22         $this->assertDatabaseMissing('comments', [
23             'html' => 'some_old_content',
24         ]);
25         $this->assertDatabaseHas('comments', [
26             'html' => "<p>some_fresh_content</p>\n",
27         ]);
28     }
29 }