]> BookStack Code Mirror - bookstack/blob - tests/Commands/RegenerateReferencesCommandTest.php
Comments: Added wysiwyg link selector, updated tests, removed command
[bookstack] / tests / Commands / RegenerateReferencesCommandTest.php
1 <?php
2
3 namespace Tests\Commands;
4
5 use Illuminate\Support\Facades\DB;
6 use Tests\TestCase;
7
8 class RegenerateReferencesCommandTest extends TestCase
9 {
10     public function test_regenerate_references_command()
11     {
12         $page = $this->entities->page();
13         $book = $page->book;
14
15         $page->html = '<a href="' . $book->getUrl() . '">Book Link</a>';
16         $page->save();
17
18         DB::table('references')->delete();
19
20         $this->artisan('bookstack:regenerate-references')
21             ->assertExitCode(0);
22
23         $this->assertDatabaseHas('references', [
24             'from_id'   => $page->id,
25             'from_type' => $page->getMorphClass(),
26             'to_id'     => $book->id,
27             'to_type'   => $book->getMorphClass(),
28         ]);
29     }
30 }