Permalink
Browse files

Skip SearchFormTest if DB driver doesn't support fulltext

For now, the only case are specific SQL Server setups.
  • Loading branch information...
1 parent 8cd29b6 commit df41fcdce4f3405897423856d79d09696132e796 @chillu chillu committed Dec 11, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 tests/search/SearchFormTest.php
@@ -37,8 +37,24 @@ public function setUp() {
$this->waitUntilIndexingFinished();
}
+
+ /**
+ * @return Boolean
+ */
+ protected function checkFulltextSupport() {
+ $conn = DB::getConn();
+ if(class_exists('MSSQLDatabase') && $conn instanceof MSSQLDatabase) {
+ $supports = $conn->fullTextEnabled();
+ } else {
+ $supports = true;
+ }
+ if(!$supports) $this->markTestSkipped('Fulltext not supported by DB driver or setup');
+ return $supports;
+ }
public function testPublishedPagesMatchedByTitle() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
@@ -54,6 +70,8 @@ public function testPublishedPagesMatchedByTitle() {
}
public function testDoubleQuotesPublishedPagesMatchedByTitle() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage');
@@ -72,6 +90,8 @@ public function testDoubleQuotesPublishedPagesMatchedByTitle() {
/*
public function testUnpublishedPagesNotIncluded() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$results = $sf->getResults(null, array('Search'=>'publicUnpublishedPage'));
@@ -85,6 +105,8 @@ public function testUnpublishedPagesNotIncluded() {
*/
public function testPagesRestrictedToLoggedinUsersNotIncluded() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'restrictedViewLoggedInUsers');
@@ -107,6 +129,8 @@ public function testPagesRestrictedToLoggedinUsersNotIncluded() {
}
public function testPagesRestrictedToSpecificGroupNotIncluded() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'restrictedViewOnlyWebsiteUsers');
@@ -139,6 +163,8 @@ public function testPagesRestrictedToSpecificGroupNotIncluded() {
}
public function testInheritedRestrictedPagesNotInlucded() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'inheritRestrictedView');
@@ -162,6 +188,8 @@ public function testInheritedRestrictedPagesNotInlucded() {
}
public function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
@@ -174,6 +202,8 @@ public function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
}
public function testDisabledShowInSearchFlagNotIncludedForFiles() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
@@ -194,6 +224,8 @@ public function testDisabledShowInSearchFlagNotIncludedForFiles() {
}
public function testSearchTitleAndContentWithSpecialCharacters() {
+ if(!$this->checkFulltextSupport()) return;
+
$sf = new SearchForm($this->mockController, 'SearchForm');
$pageWithSpecialChars = $this->objFromFixture('SiteTree', 'pageWithSpecialChars');

0 comments on commit df41fcd

Please sign in to comment.