1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 19:32:29 +01:00

Added test to cover search frquency rank changes

This commit is contained in:
Dan Brown 2021-11-09 15:05:02 +00:00
parent bc472ca2d7
commit da17004c3e
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -302,4 +302,22 @@ class EntitySearchTest extends TestCase
$search->assertSeeText($page->name);
$search->assertSee($page->getUrl());
}
public function test_search_ranks_common_words_lower()
{
$this->newPage(['name' => 'Test page A', 'html' => '<p>dog biscuit dog dog</p>']);
$this->newPage(['name' => 'Test page B', 'html' => '<p>cat biscuit</p>']);
$search = $this->asEditor()->get('/search?term=cat+dog+biscuit');
$search->assertElementContains('.entity-list > .page', 'Test page A', 1);
$search->assertElementContains('.entity-list > .page', 'Test page B', 2);
for ($i = 0; $i < 2; $i++) {
$this->newPage(['name' => 'Test page ' . $i, 'html' => '<p>dog</p>']);
}
$search = $this->asEditor()->get('/search?term=cat+dog+biscuit');
$search->assertElementContains('.entity-list > .page', 'Test page B', 1);
$search->assertElementContains('.entity-list > .page', 'Test page A', 2);
}
}