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