X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/da1cea06ca5db56a9635bf8bb01da2516d601620..refs/pull/2238/head:/tests/CommandsTest.php diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index e55b047d4..bfc0ac0eb 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -1,5 +1,7 @@ expectException(RuntimeException::class); $this->artisan('bookstack:update-url https://cats.example.com'); } + + public function test_regenerate_comment_content_command() + { + Comment::query()->forceCreate([ + 'html' => 'some_old_content', + 'text' => 'some_fresh_content', + ]); + + $this->assertDatabaseHas('comments', [ + 'html' => 'some_old_content', + ]); + + $exitCode = \Artisan::call('bookstack:regenerate-comment-content'); + $this->assertTrue($exitCode === 0, 'Command executed successfully'); + + $this->assertDatabaseMissing('comments', [ + 'html' => 'some_old_content', + ]); + $this->assertDatabaseHas('comments', [ + 'html' => "

some_fresh_content

\n", + ]); + } }