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