mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Covered untested commands with testing
This commit is contained in:
29
tests/Commands/RegenerateSearchCommandTest.php
Normal file
29
tests/Commands/RegenerateSearchCommandTest.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Commands;
|
||||
|
||||
use BookStack\Search\SearchTerm;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class RegenerateSearchCommandTest extends TestCase
|
||||
{
|
||||
public function test_command_regenerates_index()
|
||||
{
|
||||
DB::rollBack();
|
||||
$page = $this->entities->page();
|
||||
SearchTerm::truncate();
|
||||
|
||||
$this->assertDatabaseMissing('search_terms', ['entity_id' => $page->id]);
|
||||
|
||||
$this->artisan('bookstack:regenerate-search')
|
||||
->expectsOutput('Search index regenerated!')
|
||||
->assertExitCode(0);
|
||||
|
||||
$this->assertDatabaseHas('search_terms', [
|
||||
'entity_type' => 'page',
|
||||
'entity_id' => $page->id
|
||||
]);
|
||||
DB::beginTransaction();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user