BookStack/tests/Commands/RegenerateSearchCommandTest.php

30 lines
738 B
PHP
Raw Permalink Normal View History

2023-05-24 05:34:43 -04:00
<?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();
}
}