Skip to content

Commit

Permalink
Merge pull request #1772 from dhensby/pulls/test-update
Browse files Browse the repository at this point in the history
Test fixes for upstream changes
  • Loading branch information
dhensby authored Mar 30, 2017
2 parents 2cb78e9 + 72cbf83 commit 83e0947
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<directory>tests</directory>
</testsuite>

<listeners>
<listener class="SilverStripe\Dev\TestListener" />
</listeners>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">.</directory>
Expand Down
14 changes: 10 additions & 4 deletions tests/controller/ContentControllerSearchExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
class ContentControllerSearchExtensionTest extends SapphireTest
{

protected static $required_extensions = array(
ContentController::class => [
\SilverStripe\CMS\Search\ContentControllerSearchExtension::class,
],
);

public function testCustomSearchFormClassesToTest()
{
$page = new Page();
Expand All @@ -25,9 +31,9 @@ public function testCustomSearchFormClassesToTest()
}
}

public function setUpOnce()
public static function setUpBeforeClass()
{
parent::setUpOnce();
parent::setUpBeforeClass();

FulltextSearchable::enable('SilverStripe\\Assets\\File');
}
Expand All @@ -37,9 +43,9 @@ public function setUpOnce()
* properly at the end of the test. This becomes apparent when a later test tries to
* ALTER TABLE File and add fulltext indexes with the InnoDB table type.
*/
public function tearDownOnce()
public static function tearDownAfterClass()
{
parent::tearDownOnce();
parent::tearDownAfterClass();

Config::inst()->update('SilverStripe\\Assets\\File', 'create_table_options', array('SilverStripe\ORM\Connect\MySQLDatabase' => 'ENGINE=InnoDB'));
File::remove_extension('SilverStripe\\ORM\\Search\\FulltextSearchable');
Expand Down
2 changes: 1 addition & 1 deletion tests/model/SiteTreeBacklinksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SiteTreeBacklinksTest extends SapphireTest
{
protected static $fixture_file = "SiteTreeBacklinksTest.yml";

protected $requiredExtensions = array(
protected static $required_extensions = array(
'SilverStripe\\CMS\\Model\\SiteTree' => array('SiteTreeBacklinksTest_DOD'),
);

Expand Down
2 changes: 1 addition & 1 deletion tests/model/SiteTreePermissionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SiteTreePermissionsTest extends FunctionalTest
{
protected static $fixture_file = "SiteTreePermissionsTest.yml";

protected $illegalExtensions = array(
protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites')
);

Expand Down
6 changes: 3 additions & 3 deletions tests/model/SiteTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class SiteTreeTest extends SapphireTest

protected static $fixture_file = 'SiteTreeTest.yml';

protected $illegalExtensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable')
protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable'),
);

protected $extraDataObjects = array(
protected static $extra_dataobjects = array(
SiteTreeTest_ClassA::class,
SiteTreeTest_ClassB::class,
SiteTreeTest_ClassC::class,
Expand Down
8 changes: 4 additions & 4 deletions tests/model/VirtualPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VirtualPageTest extends FunctionalTest
protected static $use_draft_site = false;
protected $autoFollowRedirection = false;

protected $extraDataObjects = array(
protected static $extra_dataobjects = array(
'VirtualPageTest_ClassA',
'VirtualPageTest_ClassB',
'VirtualPageTest_ClassC',
Expand All @@ -31,11 +31,11 @@ class VirtualPageTest extends FunctionalTest
'VirtualPageTest_VirtualPageSub',
);

protected $illegalExtensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable')
protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable'),
);

protected $requiredExtensions = array(
protected static $required_extensions = array(
SiteTree::class => array('VirtualPageTest_PageExtension')
);

Expand Down
12 changes: 6 additions & 6 deletions tests/search/SearchFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ZZZSearchFormTest extends FunctionalTest

protected static $fixture_file = 'SearchFormTest.yml';

protected $illegalExtensions = array(
protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable')
);

Expand All @@ -46,16 +46,16 @@ public function waitUntilIndexingFinished()
}
}

public function setUpOnce()
public static function setUpBeforeClass()
{
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
// MySQL will need a different table type
self::kill_temp_db();
static::kill_temp_db();
Config::modify();
FulltextSearchable::enable();
self::create_temp_db();
$this->resetDBSchema(true);
parent::setUpOnce();
static::create_temp_db();
static::resetDBSchema(true);
parent::setUpBeforeClass();
}

public function setUp()
Expand Down

0 comments on commit 83e0947

Please sign in to comment.