mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: force the test to wait until indexing completes. Do not use stop words ('me')
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@110130 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
deae822827
commit
8b5ab77f42
@ -24,6 +24,11 @@ class SearchFormTest extends FunctionalTest {
|
||||
),
|
||||
);
|
||||
|
||||
function waitUntilIndexingFinished() {
|
||||
$db = DB::getConn();
|
||||
if (method_exists($db, 'waitUntilIndexingFinished')) DB::getConn()->waitUntilIndexingFinished();
|
||||
}
|
||||
|
||||
function setUpOnce() {
|
||||
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
|
||||
if(is_a(DB::getConn(), 'PostgreSQLDatabase')) {
|
||||
@ -38,6 +43,8 @@ class SearchFormTest extends FunctionalTest {
|
||||
|
||||
$holderPage = $this->objFromFixture('SiteTree', 'searchformholder');
|
||||
$this->mockController = new ContentController($holderPage);
|
||||
|
||||
$this->waitUntilIndexingFinished();
|
||||
}
|
||||
|
||||
function testPublishedPagesMatchedByTitle() {
|
||||
@ -45,6 +52,8 @@ class SearchFormTest extends FunctionalTest {
|
||||
|
||||
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
||||
$publishedPage->publish('Stage', 'Live');
|
||||
|
||||
$this->waitUntilIndexingFinished();
|
||||
$results = $sf->getResults(null, array('Search'=>'publicPublishedPage'));
|
||||
$this->assertContains(
|
||||
$publishedPage->ID,
|
||||
@ -57,10 +66,12 @@ class SearchFormTest extends FunctionalTest {
|
||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||
|
||||
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
|
||||
$publishedPage->Title = "finding me";
|
||||
$publishedPage->Title = "finding butterflies";
|
||||
$publishedPage->write();
|
||||
$publishedPage->publish('Stage', 'Live');
|
||||
$results = $sf->getResults(null, array('Search'=>'"finding me"'));
|
||||
|
||||
$this->waitUntilIndexingFinished();
|
||||
$results = $sf->getResults(null, array('Search'=>'"finding butterflies"'));
|
||||
$this->assertContains(
|
||||
$publishedPage->ID,
|
||||
$results->column('ID'),
|
||||
|
Loading…
Reference in New Issue
Block a user