mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Remove TestListener and rely on PHPUnits APIs
This commit is contained in:
parent
fbddd84cea
commit
ac075eaf0b
@ -143,8 +143,9 @@ end of each test.
|
||||
}
|
||||
}
|
||||
|
||||
`tearDownOnce` and `setUpOnce` can be used to run code just once for the file rather than before and after each
|
||||
individual test case.
|
||||
`tearDownAfterClass` and `setUpBeforeClass` can be used to run code just once for the file rather than before and after
|
||||
each individual test case. Remember to class the parent method in each method to ensure the core boot-strapping of tests
|
||||
takes place.
|
||||
|
||||
:::php
|
||||
<?php
|
||||
@ -153,16 +154,16 @@ individual test case.
|
||||
|
||||
class PageTest extends SapphireTest
|
||||
{
|
||||
function setUpOnce()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpOnce();
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
// ..
|
||||
}
|
||||
|
||||
public function tearDownOnce()
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
parent::tearDownOnce();
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
// ..
|
||||
}
|
||||
@ -179,9 +180,9 @@ If you need to make changes to `Config` (or `Injector`) for each test (or the wh
|
||||
It's important to remember that the `parent::setUp();` functions will need to be called first to ensure the nesting feature works as expected.
|
||||
|
||||
:::php
|
||||
public function setUpOnce()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpOnce();
|
||||
parent::setUpBeforeClass();
|
||||
//this will remain for the whole suite and be removed for any other tests
|
||||
Config::inst()->update('ClassName', 'var_name', 'var_value');
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ guide developers in preparing existing 3.x code for compatibility with 4.0
|
||||
* [i18n](#overview-i18n)
|
||||
* [Cache](#overview-cache)
|
||||
* [Email and Mailer](#overview-mailer)
|
||||
* [SapphireTest](#overview-testing)
|
||||
* [Commit History](#commit-history)
|
||||
|
||||
## <a name="overview"></a>Highlights of major changes
|
||||
@ -1703,3 +1704,12 @@ After (`mysite/_config/config.yml`):
|
||||
* `$email->setTemplate()` renamed to `$email->setHTMLTemplate()`
|
||||
* Added `$email->setPlainTemplate` for rendering plain versions of email
|
||||
* `$email->populateTemplate()` has been replaced with `$email->setData()`
|
||||
|
||||
### <a name="overview-testing"></a>SapphireTest
|
||||
|
||||
* `setUpOnce` removed. Please use `setUpBeforeClass`
|
||||
* `tearDownOnce` removed. Please use `tearDownAfterClass`
|
||||
* `TestListener` class removed
|
||||
* `SapphireTest::$requiredExtensions` renamed to `SapphireTest::$required_extensions` and made static
|
||||
* `SapphireTest::$extraDataObjects` renamed to `SapphireTest::$extra_dataobjects` and made static
|
||||
* `SapphireTest::$extraControllers` renamed to `SapphireTest::$extra_controllers` and made static
|
||||
|
@ -25,10 +25,6 @@
|
||||
<directory>versioned/tests/php</directory>
|
||||
</testsuite>
|
||||
|
||||
<listeners>
|
||||
<listener class="SilverStripe\Dev\TestListener" />
|
||||
</listeners>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>sanitychecks</group>
|
||||
|
@ -117,8 +117,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
* The keys of the are the classes that the extensions can't be applied the extensions to, and
|
||||
* the values are an array of illegal extensions on that class.
|
||||
*/
|
||||
protected $illegalExtensions = array(
|
||||
);
|
||||
protected static $illegal_extensions = [];
|
||||
|
||||
/**
|
||||
* A list of extensions that must be applied during the execution of this run. If they are
|
||||
@ -132,15 +131,14 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
* array("MyTreeDataObject" => array("Versioned", "Hierarchy"))
|
||||
* </code>
|
||||
*/
|
||||
protected $requiredExtensions = array(
|
||||
);
|
||||
protected static $required_extensions = [];
|
||||
|
||||
/**
|
||||
* By default, the test database won't contain any DataObjects that have the interface TestOnly.
|
||||
* This variable lets you define additional TestOnly DataObjects to set up for this test.
|
||||
* Set it to an array of DataObject subclass names.
|
||||
*/
|
||||
protected $extraDataObjects = array();
|
||||
protected static $extra_dataobjects = [];
|
||||
|
||||
/**
|
||||
* List of class names of {@see Controller} objects to register routes for
|
||||
@ -148,7 +146,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $extraControllers = [];
|
||||
protected static $extra_controllers = [];
|
||||
|
||||
/**
|
||||
* We need to disabling backing up of globals to avoid overriding
|
||||
@ -159,12 +157,14 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
protected $backupGlobals = false;
|
||||
|
||||
/**
|
||||
* Helper arrays for illegalExtensions/requiredExtensions code
|
||||
* Helper arrays for illegal_extensions/required_extensions code
|
||||
*/
|
||||
private $extensionsToReapply = array(), $extensionsToRemove = array();
|
||||
private static $extensions_to_reapply = [];
|
||||
|
||||
private static $extensions_to_remove = [];
|
||||
|
||||
/**
|
||||
* Check flushables on setupOnce()
|
||||
* Check flushables on setupBeforeClass()
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
@ -334,10 +334,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
* This is different to {@link setUp()}, which gets called once
|
||||
* per method. Useful to initialize expensive operations which
|
||||
* don't change state for any called method inside the test,
|
||||
* e.g. dynamically adding an extension. See {@link tearDownOnce()}
|
||||
* e.g. dynamically adding an extension. See {@link teardownAfterClass()}
|
||||
* for tearing down the state again.
|
||||
*/
|
||||
public function setUpOnce()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
static::start();
|
||||
|
||||
@ -351,40 +351,40 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Remove any illegal extensions that are present
|
||||
foreach ($this->illegalExtensions as $class => $extensions) {
|
||||
foreach (static::$illegal_extensions as $class => $extensions) {
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($extensions as $extension) {
|
||||
if (!class_exists($extension) || $class::has_extension($extension)) {
|
||||
if (!class_exists($extension) ||$class::has_extension($extension)) {
|
||||
continue;
|
||||
}if (!isset(static::$extensions_to_reapply[$class])) {
|
||||
static::$extensions_to_reapply[$class] = array();
|
||||
}
|
||||
if (!isset($this->extensionsToReapply[$class])) {
|
||||
$this->extensionsToReapply[$class] = array();
|
||||
}
|
||||
$this->extensionsToReapply[$class][] = $extension;
|
||||
static::$extensions_to_reapply[$class][] = $extension;
|
||||
$class::remove_extension($extension);
|
||||
$isAltered = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Add any required extensions that aren't present
|
||||
foreach ($this->requiredExtensions as $class => $extensions) {
|
||||
foreach (static::$required_extensions as $class => $extensions) {
|
||||
if (!class_exists($class)) {
|
||||
$self = static::class;
|
||||
throw new LogicException("Test {$self} requires class {$class} which doesn't exist");
|
||||
}
|
||||
$this->extensionsToRemove[$class] = array();
|
||||
static::$extensions_to_remove[$class] = array();
|
||||
foreach ($extensions as $extension) {
|
||||
if (!class_exists($extension)) {
|
||||
$self = static::class;
|
||||
throw new LogicException("Test {$self} requires extension {$extension} which doesn't exist");
|
||||
}
|
||||
if (!$class::has_extension($extension)) {
|
||||
if (!isset($this->extensionsToRemove[$class])) {
|
||||
$this->extensionsToReapply[$class] = array();
|
||||
if (!isset(static::$extensions_to_remove[$class])) {
|
||||
static::$extensions_to_reapply[$class] = array();
|
||||
}
|
||||
$this->extensionsToRemove[$class][] = $extension;
|
||||
static::$extensions_to_remove[$class][] = $extension;
|
||||
$class::add_extension($extension);
|
||||
$isAltered = true;
|
||||
}
|
||||
@ -392,12 +392,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// If we have made changes to the extensions present, then migrate the database schema.
|
||||
if ($isAltered || $this->extensionsToReapply || $this->extensionsToRemove || $this->getExtraDataObjects()) {
|
||||
if ($isAltered || static::$extensions_to_reapply || static::$extensions_to_remove || static::getExtraDataObjects()) {
|
||||
DataObject::reset();
|
||||
if (!self::using_temp_db()) {
|
||||
self::create_temp_db();
|
||||
}
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
// clear singletons, they're caching old extension info
|
||||
// which is used in DatabaseAdmin->doBuild()
|
||||
@ -419,23 +419,23 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* tearDown method that's called once per test class rather once per test method.
|
||||
*/
|
||||
public function tearDownOnce()
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
// If we have made changes to the extensions present, then migrate the database schema.
|
||||
if ($this->extensionsToReapply || $this->extensionsToRemove) {
|
||||
if (static::$extensions_to_reapply || static::$extensions_to_remove) {
|
||||
// @todo: This isn't strictly necessary to restore extensions, but only to ensure that
|
||||
// Object::$extra_methods is properly flushed. This should be replaced with a simple
|
||||
// flush mechanism for each $class.
|
||||
//
|
||||
// Remove extensions added for testing
|
||||
foreach ($this->extensionsToRemove as $class => $extensions) {
|
||||
foreach (static::$extensions_to_remove as $class => $extensions) {
|
||||
foreach ($extensions as $extension) {
|
||||
$class::remove_extension($extension);
|
||||
}
|
||||
}
|
||||
|
||||
// Reapply ones removed
|
||||
foreach ($this->extensionsToReapply as $class => $extensions) {
|
||||
foreach (static::$extensions_to_reapply as $class => $extensions) {
|
||||
foreach ($extensions as $extension) {
|
||||
$class::add_extension($extension);
|
||||
}
|
||||
@ -443,13 +443,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
//unnest injector / config now that the test suite is over
|
||||
// this will reset all the extensions on the object too (see setUpOnce)
|
||||
// this will reset all the extensions on the object too (see setUpBeforeClass)
|
||||
Injector::unnest();
|
||||
Config::unnest();
|
||||
|
||||
$extraDataObjects = $this->getExtraDataObjects();
|
||||
if (!empty($this->extensionsToReapply) || !empty($this->extensionsToRemove) || !empty($extraDataObjects)) {
|
||||
$this->resetDBSchema();
|
||||
$extraDataObjects = static::getExtraDataObjects();
|
||||
if (!empty(static::$extensions_to_reapply) || !empty(static::$extensions_to_remove) || !empty($extraDataObjects)) {
|
||||
static::resetDBSchema();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1034,7 +1034,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
ClassLoader::instance()->pushManifest($classManifest, false);
|
||||
SapphireTest::set_test_class_manifest($classManifest);
|
||||
static::set_test_class_manifest($classManifest);
|
||||
|
||||
ThemeResourceLoader::instance()->addSet('$default', new ThemeManifest(
|
||||
BASE_PATH,
|
||||
@ -1123,9 +1123,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$dbConn->selectDatabase($dbname, true);
|
||||
|
||||
/** @var static $st */
|
||||
$st = Injector::inst()->create(__CLASS__);
|
||||
$st->resetDBSchema();
|
||||
static::resetDBSchema();
|
||||
|
||||
// Reinstate PHPUnit error handling
|
||||
set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError'));
|
||||
@ -1153,7 +1151,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
* Reset the testing database's schema.
|
||||
* @param bool $includeExtraDataObjects If true, the extraDataObjects tables will also be included
|
||||
*/
|
||||
public function resetDBSchema($includeExtraDataObjects = false)
|
||||
public static function resetDBSchema($includeExtraDataObjects = false)
|
||||
{
|
||||
if (self::using_temp_db()) {
|
||||
DataObject::reset();
|
||||
@ -1161,12 +1159,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
// clear singletons, they're caching old extension info which is used in DatabaseAdmin->doBuild()
|
||||
Injector::inst()->unregisterAllObjects();
|
||||
|
||||
$dataClasses = ClassInfo::subclassesFor('SilverStripe\\ORM\\DataObject');
|
||||
$dataClasses = ClassInfo::subclassesFor(DataObject::class);
|
||||
array_shift($dataClasses);
|
||||
|
||||
DB::quiet();
|
||||
$schema = DB::get_schema();
|
||||
$extraDataObjects = $includeExtraDataObjects ? $this->getExtraDataObjects() : null;
|
||||
$extraDataObjects = $includeExtraDataObjects ? static::getExtraDataObjects() : null;
|
||||
$schema->schemaUpdate(function () use ($dataClasses, $extraDataObjects) {
|
||||
foreach ($dataClasses as $dataClass) {
|
||||
// Check if class exists before trying to instantiate - this sidesteps any manifest weirdness
|
||||
@ -1306,12 +1304,11 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Return all extra objects to scaffold for this test
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return $this->extraDataObjects;
|
||||
return static::$extra_dataobjects;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1319,9 +1316,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getExtraControllers()
|
||||
protected static function getExtraControllers()
|
||||
{
|
||||
return $this->extraControllers;
|
||||
return static::$extra_controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Dev;
|
||||
|
||||
use PHPUnit_Framework_TestListener;
|
||||
use PHPUnit_Framework_TestSuite;
|
||||
use PHPUnit_Framework_Test;
|
||||
use Exception;
|
||||
use PHPUnit_Framework_AssertionFailedError;
|
||||
|
||||
/**
|
||||
* Inject SilverStripe 'setUpOnce' and 'tearDownOnce' unittest extension methods into PHPUnit.
|
||||
*
|
||||
* This is already in later SilverStripe 2.4 versions, but having it here extends compatibility to older versions.
|
||||
*/
|
||||
class SilverStripeListener implements PHPUnit_Framework_TestListener
|
||||
{
|
||||
|
||||
protected function isValidClass($name)
|
||||
{
|
||||
return (class_exists($name) && is_subclass_of($name, 'SilverStripe\\Dev\\SapphireTest'));
|
||||
}
|
||||
|
||||
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
$name = $suite->getName();
|
||||
if (!$this->isValidClass($name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var SapphireTest $class */
|
||||
$class = new $name();
|
||||
$class->setUpOnce();
|
||||
}
|
||||
|
||||
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
$name = $suite->getName();
|
||||
if (!$this->isValidClass($name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var SapphireTest $class */
|
||||
$class = new $name();
|
||||
$class->tearDownOnce();
|
||||
}
|
||||
|
||||
public function startTest(PHPUnit_Framework_Test $test)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTest(PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Risky test.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param Exception $e
|
||||
* @param float $time
|
||||
* @since Method available since Release 3.8.0
|
||||
*/
|
||||
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
// Stub out to support PHPUnit 3.8
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Dev;
|
||||
|
||||
use PHPUnit_Framework_TestListener;
|
||||
use PHPUnit_Framework_Test;
|
||||
use PHPUnit_Framework_AssertionFailedError;
|
||||
use PHPUnit_Framework_TestSuite;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Necessary to call setUpOnce() and tearDownOnce() on {@link SapphireTest}
|
||||
* classes. This feature doesn't exist in PHPUnit in the same way
|
||||
* (setUpBeforeClass() and tearDownAfterClass() are just called statically).
|
||||
*
|
||||
* @see http://www.phpunit.de/manual/3.5/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener
|
||||
*/
|
||||
class TestListener implements PHPUnit_Framework_TestListener
|
||||
{
|
||||
|
||||
/**
|
||||
* @var SapphireTest
|
||||
*/
|
||||
protected $class;
|
||||
|
||||
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(PHPUnit_Framework_Test $test)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTest(PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
$name = $suite->getName();
|
||||
if (!$this->isValidClass($name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->class = new $name();
|
||||
$this->class->setUpOnce();
|
||||
}
|
||||
|
||||
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
$name = $suite->getName();
|
||||
if (!$this->isValidClass($name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->class->tearDownOnce();
|
||||
}
|
||||
|
||||
/**
|
||||
* Risky test.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param Exception $e
|
||||
* @param float $time
|
||||
* @since Method available since Release 3.8.0
|
||||
*/
|
||||
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
// Stub out to support PHPUnit 3.8
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name Class Name
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isValidClass($name)
|
||||
{
|
||||
return (class_exists($name) && is_subclass_of($name, 'SilverStripe\\Dev\\SapphireTest'));
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ class ControllerTest extends FunctionalTest
|
||||
|
||||
protected $depSettings = null;
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
AccessBaseController::class,
|
||||
AccessSecuredController::class,
|
||||
AccessWildcardSecuredController::class,
|
||||
|
@ -7,12 +7,12 @@ use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class AccessBaseController extends Controller implements TestOnly
|
||||
{
|
||||
private static $allowed_actions = array();
|
||||
private static $allowed_actions = [];
|
||||
|
||||
private static $url_segment = 'AccessBaseController';
|
||||
|
||||
private static $extensions = [
|
||||
AccessBaseControllerExtension::class
|
||||
AccessBaseControllerExtension::class,
|
||||
];
|
||||
|
||||
// Denied for all
|
||||
|
@ -28,8 +28,8 @@ class DirectorTest extends SapphireTest
|
||||
|
||||
protected $originalSession = array();
|
||||
|
||||
protected $extraControllers = [
|
||||
TestController::class
|
||||
protected static $extra_controllers = [
|
||||
TestController::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
@ -306,12 +306,14 @@ class DirectorTest extends SapphireTest
|
||||
*/
|
||||
public function testQueryIsEnvironment()
|
||||
{
|
||||
if (!isset($_SESSION)) {
|
||||
$_SESSION = [];
|
||||
}
|
||||
// Reset
|
||||
unset($_SESSION['isDev']);
|
||||
unset($_SESSION['isLive']);
|
||||
unset($_GET['isTest']);
|
||||
unset($_GET['isDev']);
|
||||
$_SESSION = $_SESSION ?: array();
|
||||
|
||||
// Test isDev=1
|
||||
$_GET['isDev'] = '1';
|
||||
|
@ -24,7 +24,7 @@ class RequestHandlingTest extends FunctionalTest
|
||||
{
|
||||
protected static $fixture_file = null;
|
||||
|
||||
protected $illegalExtensions = array(
|
||||
protected static $illegal_extensions = array(
|
||||
// Suppress CMS error page handling
|
||||
Controller::class => array(
|
||||
ErrorPageControllerExtension::class,
|
||||
@ -37,7 +37,7 @@ class RequestHandlingTest extends FunctionalTest
|
||||
),
|
||||
);
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
TestController::class,
|
||||
AllowedController::class,
|
||||
ControllerFormWithAllowedActions::class,
|
||||
|
@ -20,7 +20,7 @@ use SilverStripe\View\ViewableData;
|
||||
class ClassInfoTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
BaseClass::class,
|
||||
BaseDataClass::class,
|
||||
ChildClass::class,
|
||||
|
@ -8,7 +8,10 @@ use SilverStripe\Dev\Tests\BulkLoaderResultTest\Player;
|
||||
|
||||
class BulkLoaderResultTest extends SapphireTest
|
||||
{
|
||||
protected $extraDataObjects = array(Player::class);
|
||||
|
||||
protected static $extra_dataobjects = [
|
||||
Player::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ class CsvBulkLoaderTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'CsvBulkLoaderTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Team::class,
|
||||
Player::class,
|
||||
PlayerContract::class,
|
||||
|
@ -17,7 +17,7 @@ class FixtureBlueprintTest extends SapphireTest
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestDataObject::class,
|
||||
DataObjectRelation::class,
|
||||
TestSiteTree::class,
|
||||
|
@ -13,7 +13,7 @@ class FixtureFactoryTest extends SapphireTest
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestDataObject::class,
|
||||
DataObjectRelation::class
|
||||
);
|
||||
|
@ -15,7 +15,7 @@ use SilverStripe\Control\Director;
|
||||
class YamlFixtureTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestDataObject::class,
|
||||
DataObjectRelation::class,
|
||||
);
|
||||
|
@ -13,7 +13,7 @@ class CheckboxFieldTest extends SapphireTest
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Article::class,
|
||||
);
|
||||
|
||||
|
@ -23,7 +23,7 @@ class CheckboxSetFieldTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'CheckboxSetFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Article::class,
|
||||
Tag::class,
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ use SilverStripe\Forms\Tests\EmailFieldTest\TestValidator;
|
||||
class EmailFieldTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
EmailFieldTest\TestController::class,
|
||||
];
|
||||
|
||||
|
@ -13,13 +13,13 @@ use SilverStripe\Versioned\Versioned;
|
||||
|
||||
class FormFactoryTest extends SapphireTest
|
||||
{
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
TestObject::class,
|
||||
];
|
||||
|
||||
protected static $fixture_file = 'FormFactoryTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
// Prevent setup breaking if versioned module absent
|
||||
if (class_exists(Versioned::class)) {
|
||||
|
@ -17,7 +17,7 @@ use ReflectionClass;
|
||||
class FormFieldTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $requiredExtensions = array(
|
||||
protected static $required_extensions = array(
|
||||
FormField::class => array(
|
||||
TestExtension::class
|
||||
)
|
||||
|
@ -20,13 +20,13 @@ class FormScaffolderTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'FormScaffolderTest.yml';
|
||||
|
||||
protected $requiredExtensions = [
|
||||
protected static $required_extensions = [
|
||||
Article::class => [
|
||||
ArticleExtension::class
|
||||
]
|
||||
];
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Article::class,
|
||||
Tag::class,
|
||||
Author::class,
|
||||
|
@ -35,12 +35,12 @@ class FormTest extends FunctionalTest
|
||||
|
||||
protected static $fixture_file = 'FormTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Player::class,
|
||||
Team::class,
|
||||
);
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
TestController::class,
|
||||
ControllerWithSecurityToken::class,
|
||||
ControllerWithStrictPostCheck::class,
|
||||
|
@ -19,15 +19,15 @@ class GridFieldAddExistingAutocompleterTest extends FunctionalTest
|
||||
|
||||
protected static $fixture_file = 'GridFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
Team::class,
|
||||
Cheerleader::class,
|
||||
Player::class,
|
||||
Permissions::class
|
||||
];
|
||||
|
||||
protected $extraControllers = [
|
||||
TestController::class
|
||||
protected static $extra_controllers = [
|
||||
TestController::class,
|
||||
];
|
||||
|
||||
public function testScaffoldSearchFields()
|
||||
|
@ -28,32 +28,32 @@ class GridFieldDeleteActionTest extends SapphireTest
|
||||
|
||||
/**
|
||||
* @var ArrayList
|
||||
*/
|
||||
*/
|
||||
protected $list;
|
||||
|
||||
/**
|
||||
* @var GridField
|
||||
*/
|
||||
*/
|
||||
protected $gridField;
|
||||
|
||||
/**
|
||||
* @var Form
|
||||
*/
|
||||
*/
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected static $fixture_file = 'GridFieldActionTest.yml';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $extraDataObjects = [
|
||||
*/
|
||||
protected static $extra_dataobjects = [
|
||||
Team::class,
|
||||
Cheerleader::class,
|
||||
Player::class,
|
||||
Permissions::class
|
||||
Permissions::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
|
@ -21,13 +21,13 @@ class GridFieldDetailFormTest extends FunctionalTest
|
||||
|
||||
protected static $fixture_file = 'GridFieldDetailFormTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Person::class,
|
||||
PeopleGroup::class,
|
||||
Category::class,
|
||||
);
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
CategoryController::class,
|
||||
TestController::class,
|
||||
GroupController::class,
|
||||
|
@ -23,32 +23,32 @@ class GridFieldEditButtonTest extends SapphireTest
|
||||
|
||||
/**
|
||||
* @var ArrayList
|
||||
*/
|
||||
*/
|
||||
protected $list;
|
||||
|
||||
/**
|
||||
* @var GridField
|
||||
*/
|
||||
*/
|
||||
protected $gridField;
|
||||
|
||||
/**
|
||||
* @var Form
|
||||
*/
|
||||
*/
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected static $fixture_file = 'GridFieldActionTest.yml';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $extraDataObjects = array(
|
||||
*/
|
||||
protected static $extra_dataobjects = array(
|
||||
Team::class,
|
||||
Cheerleader::class,
|
||||
Player::class,
|
||||
Permissions::class
|
||||
Permissions::class,
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
|
@ -24,9 +24,9 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'GridFieldExportButtonTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Team::class,
|
||||
NoView::class
|
||||
NoView::class,
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
|
@ -43,7 +43,7 @@ class GridFieldPaginatorTest extends FunctionalTest
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Team::class,
|
||||
Player::class,
|
||||
Cheerleader::class,
|
||||
|
@ -15,8 +15,8 @@ use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject;
|
||||
class GridFieldPrintButtonTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
TestObject::class
|
||||
protected static $extra_dataobjects = array(
|
||||
TestObject::class,
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
|
@ -21,12 +21,12 @@ class GridFieldSortableHeaderTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'GridFieldSortableHeaderTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
Team::class,
|
||||
TeamGroup::class,
|
||||
Cheerleader::class,
|
||||
CheerleaderHat::class,
|
||||
Mom::class
|
||||
Mom::class,
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ use SilverStripe\Security\Member;
|
||||
|
||||
class GridFieldTest extends SapphireTest
|
||||
{
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
Permissions::class,
|
||||
Cheerleader::class,
|
||||
Player::class,
|
||||
|
@ -11,8 +11,8 @@ use SilverStripe\Forms\Tests\GridField\GridField_URLHandlerTest\TestController;
|
||||
class GridField_URLHandlerTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected $extraControllers = [
|
||||
TestController::class
|
||||
protected static $extra_controllers = [
|
||||
TestController::class,
|
||||
];
|
||||
|
||||
public function testFormSubmission()
|
||||
|
@ -29,13 +29,15 @@ class HTMLEditorFieldTest extends FunctionalTest
|
||||
|
||||
protected static $use_draft_site = true;
|
||||
|
||||
protected $requiredExtensions = array(
|
||||
protected static $required_extensions= array(
|
||||
HTMLEditorField_Toolbar::class => array(
|
||||
DummyMediaFormFieldExtension::class
|
||||
)
|
||||
DummyMediaFormFieldExtension::class,
|
||||
),
|
||||
);
|
||||
|
||||
protected $extraDataObjects = array(TestObject::class);
|
||||
protected static $extra_dataobjects = [
|
||||
TestObject::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
|
@ -17,10 +17,10 @@ class ListboxFieldTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'ListboxFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestObject::class,
|
||||
Article::class,
|
||||
Tag::class
|
||||
Tag::class,
|
||||
);
|
||||
|
||||
public function testFieldWithManyManyRelationship()
|
||||
|
@ -12,7 +12,7 @@ use SilverStripe\Forms\MoneyField;
|
||||
class MoneyFieldTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestObject::class,
|
||||
CustomSetter_Object::class,
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ class ComponentSetTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'ComponentSetTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
ComponentSetTest\Player::class,
|
||||
ComponentSetTest\Team::class,
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ use SilverStripe\Dev\SapphireTest;
|
||||
class DBClassNameTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
DBClassNameTest\TestObject::class,
|
||||
DBClassNameTest\ObjectSubClass::class,
|
||||
DBClassNameTest\ObjectSubSubClass::class,
|
||||
|
@ -9,7 +9,7 @@ use SilverStripe\Dev\SapphireTest;
|
||||
class DBCompositeTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DBCompositeTest\TestObject::class,
|
||||
DBCompositeTest\SubclassedDBFieldObject::class,
|
||||
);
|
||||
|
@ -13,7 +13,7 @@ class DBMoneyTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'DBMoneyTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DBMoneyTest\TestObject::class,
|
||||
DBMoneyTest\TestObjectSubclass::class,
|
||||
);
|
||||
|
@ -15,7 +15,7 @@ class DataExtensionTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'DataExtensionTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DataExtensionTest\TestMember::class,
|
||||
DataExtensionTest\Player::class,
|
||||
DataExtensionTest\RelatedObject::class,
|
||||
@ -25,7 +25,7 @@ class DataExtensionTest extends SapphireTest
|
||||
DataExtensionTest\CMSFieldsGrandChild::class
|
||||
);
|
||||
|
||||
protected $requiredExtensions = [
|
||||
protected static $required_extensions = [
|
||||
DataObject::class => [
|
||||
DataExtensionTest\AppliedToDO::class,
|
||||
]
|
||||
@ -116,7 +116,7 @@ class DataExtensionTest extends SapphireTest
|
||||
);
|
||||
|
||||
// Now that we've just added the extension, we need to rebuild the database
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
|
||||
// Create a test record with extended fields, writing to the DB
|
||||
$player = new DataExtensionTest\Player();
|
||||
|
@ -24,7 +24,7 @@ class DataListTest extends SapphireTest
|
||||
// Borrow the model from DataObjectTest
|
||||
protected static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -11,7 +11,7 @@ class DataObjectDuplicationTest extends SapphireTest
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DataObjectDuplicationTest\Class1::class,
|
||||
DataObjectDuplicationTest\Class2::class,
|
||||
DataObjectDuplicationTest\Class3::class
|
||||
|
@ -15,7 +15,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
|
||||
'DataObjectTest.yml',
|
||||
);
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -13,12 +13,12 @@ use SilverStripe\ORM\Tests\DataObjectSchemaGenerationTest\TestObject;
|
||||
class DataObjectSchemaGenerationTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestObject::class,
|
||||
TestIndexObject::class
|
||||
);
|
||||
|
||||
public function setUpOnce()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
|
||||
// enable fulltext option on this table
|
||||
@ -27,7 +27,7 @@ class DataObjectSchemaGenerationTest extends SapphireTest
|
||||
array(MySQLSchemaManager::ID => 'ENGINE=MyISAM')
|
||||
);
|
||||
|
||||
parent::setUpOnce();
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ use SilverStripe\ORM\Tests\DataObjectSchemaTest\WithRelation;
|
||||
*/
|
||||
class DataObjectSchemaTest extends SapphireTest
|
||||
{
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
// Classes in base namespace
|
||||
BaseClass::class,
|
||||
BaseDataClass::class,
|
||||
|
@ -53,7 +53,7 @@ class DataObjectTest extends SapphireTest
|
||||
DataObjectTest\Sortable::class,
|
||||
);
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -16,7 +16,7 @@ class DataQueryTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'DataQueryTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DataQueryTest\ObjectA::class,
|
||||
DataQueryTest\ObjectB::class,
|
||||
DataQueryTest\ObjectC::class,
|
||||
@ -284,7 +284,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query->where(DB::get_conn()->comparisonClause('"SortOrder"', '2'));
|
||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find SortOrder");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testComparisonClauseDateFull()
|
||||
@ -293,7 +293,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query->where(DB::get_conn()->comparisonClause('"MyDate"', '1988-03-04%'));
|
||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testComparisonClauseDateStartsWith()
|
||||
@ -302,7 +302,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query->where(DB::get_conn()->comparisonClause('"MyDate"', '1988%'));
|
||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testComparisonClauseDateStartsPartial()
|
||||
@ -311,7 +311,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query->where(DB::get_conn()->comparisonClause('"MyDate"', '%03-04%'));
|
||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testComparisonClauseTextCaseInsensitive()
|
||||
@ -320,7 +320,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query->where(DB::get_conn()->comparisonClause('"MyString"', 'helloworld'));
|
||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyString");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testComparisonClauseTextCaseSensitive()
|
||||
@ -333,7 +333,7 @@ class DataQueryTest extends SapphireTest
|
||||
$query2 = new DataQuery(DataQueryTest\ObjectF::class);
|
||||
$query2->where(DB::get_conn()->comparisonClause('"MyString"', 'helloworld', false, false, true));
|
||||
$this->assertEquals(0, $query2->count(), "Found mystring. Shouldn't be able too.");
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ use SilverStripe\ORM\Tests\DatabaseTest\MyObject;
|
||||
class DatabaseTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
MyObject::class,
|
||||
);
|
||||
|
||||
@ -37,7 +37,7 @@ class DatabaseTest extends SapphireTest
|
||||
'Field is renamed to _obsolete_<fieldname> through dontRequireField()'
|
||||
);
|
||||
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testRenameField()
|
||||
@ -59,7 +59,7 @@ class DatabaseTest extends SapphireTest
|
||||
'Old fieldname isnt preserved through renameField()'
|
||||
);
|
||||
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
}
|
||||
|
||||
public function testMySQLCreateTableOptions()
|
||||
|
@ -11,7 +11,7 @@ class DecimalTest extends SapphireTest
|
||||
|
||||
protected $testDataObject;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
DecimalTest\TestObject::class
|
||||
);
|
||||
|
||||
|
@ -11,7 +11,7 @@ use SilverStripe\ORM\Tests\Filters\FulltextFilterTest\TestObject;
|
||||
class FulltextFilterTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TestObject::class
|
||||
);
|
||||
|
||||
|
@ -17,7 +17,7 @@ class SearchFilterApplyRelationTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'SearchFilterApplyRelationTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SearchFilterApplyRelationTest\TestObject::class,
|
||||
SearchFilterApplyRelationTest\HasOneParent::class,
|
||||
SearchFilterApplyRelationTest\HasOneChild::class,
|
||||
|
@ -11,7 +11,7 @@ class HasManyListTest extends SapphireTest
|
||||
// Borrow the model from DataObjectTest
|
||||
protected static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -12,13 +12,13 @@ class HierarchyTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'HierarchyTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
HierarchyTest\TestObject::class,
|
||||
HierarchyTest\HideTestObject::class,
|
||||
HierarchyTest\HideTestSubObject::class,
|
||||
);
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
// Prevent setup breaking if versioned module absent
|
||||
if (class_exists(Versioned::class)) {
|
||||
|
@ -13,7 +13,7 @@ class ManyManyListExtensionTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'ManyManyListExtensionTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
ManyManyListTest\IndirectPrimary::class,
|
||||
ManyManyListTest\Secondary::class,
|
||||
ManyManyListTest\SecondarySub::class
|
||||
|
@ -20,7 +20,7 @@ class ManyManyListTest extends SapphireTest
|
||||
ManyManyListTest\Product::class,
|
||||
];
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -11,7 +11,7 @@ class ManyManyThroughListTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'ManyManyThroughListTest.yml';
|
||||
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
ManyManyThroughListTest\Item::class,
|
||||
ManyManyThroughListTest\JoinObject::class,
|
||||
ManyManyThroughListTest\TestObject::class
|
||||
|
@ -14,7 +14,7 @@ class MapTest extends SapphireTest
|
||||
// Borrow the model from DataObjectTest
|
||||
protected static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -14,7 +14,7 @@ class MySQLDatabaseTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'MySQLDatabaseTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
MySQLDatabaseTest\Data::class
|
||||
);
|
||||
|
||||
|
@ -13,7 +13,7 @@ class PDODatabaseTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'MySQLDatabaseTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
MySQLDatabaseTest\Data::class
|
||||
);
|
||||
|
||||
|
@ -18,7 +18,7 @@ class PaginatedListTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -19,7 +19,7 @@ class PolymorphicHasManyListTest extends SapphireTest
|
||||
// Borrow the model from DataObjectTest
|
||||
protected static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return array_merge(
|
||||
DataObjectTest::$extra_data_objects,
|
||||
|
@ -15,7 +15,7 @@ use SilverStripe\ORM\Tests\SQLInsertTest\SQLInsertTestBase;
|
||||
class SQLInsertTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SQLInsertTestBase::class
|
||||
);
|
||||
|
||||
|
@ -15,7 +15,7 @@ class SQLSelectTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'SQLSelectTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SQLSelectTest\TestObject::class,
|
||||
SQLSelectTest\TestBase::class,
|
||||
SQLSelectTest\TestChild::class
|
||||
|
@ -15,7 +15,7 @@ class SQLUpdateTest extends SapphireTest
|
||||
|
||||
public static $fixture_file = 'SQLUpdateTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SQLUpdateTest\TestBase::class,
|
||||
SQLUpdateTest\TestChild::class
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ class SearchContextTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'SearchContextTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SearchContextTest\Person::class,
|
||||
SearchContextTest\Book::class,
|
||||
SearchContextTest\Company::class,
|
||||
|
@ -9,7 +9,7 @@ use SilverStripe\Dev\SapphireTest;
|
||||
class TransactionTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
TransactionTest\TestObject::class
|
||||
);
|
||||
|
||||
|
@ -9,7 +9,7 @@ class UnsavedRelationListTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'UnsavedRelationListTest.yml';
|
||||
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
UnsavedRelationListTest\TestObject::class
|
||||
];
|
||||
|
||||
|
@ -19,7 +19,7 @@ class BasicAuthTest extends FunctionalTest
|
||||
|
||||
protected static $fixture_file = 'BasicAuthTest.yml';
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
ControllerSecuredWithPermission::class,
|
||||
ControllerSecuredWithoutPermission::class,
|
||||
];
|
||||
|
@ -16,7 +16,7 @@ class GroupTest extends FunctionalTest
|
||||
|
||||
protected static $fixture_file = 'GroupTest.yml';
|
||||
|
||||
protected $extraDataObjects = [
|
||||
protected static $extra_dataobjects = [
|
||||
TestMember::class
|
||||
];
|
||||
|
||||
|
@ -27,7 +27,7 @@ class MemberTest extends FunctionalTest
|
||||
|
||||
protected $orig = array();
|
||||
|
||||
protected $illegalExtensions = array(
|
||||
protected static $illegal_extensions = array(
|
||||
Member::class => array(
|
||||
// TODO Coupling with modules, this should be resolved by automatically
|
||||
// removing all applied extensions before a unit test
|
||||
|
@ -40,7 +40,7 @@ class SecurityTest extends FunctionalTest
|
||||
|
||||
protected $priorRememberUsername = null;
|
||||
|
||||
protected $extraControllers = [
|
||||
protected static $extra_controllers = [
|
||||
SecurityTest\NullController::class,
|
||||
SecurityTest\SecuredController::class,
|
||||
];
|
||||
@ -663,14 +663,14 @@ class SecurityTest extends FunctionalTest
|
||||
// and has all columns present in the ORM
|
||||
/**
|
||||
* @skipUpgrade
|
||||
*/
|
||||
*/
|
||||
DB::get_schema()->renameField('Member', 'Email', 'Email_renamed');
|
||||
|
||||
// Email column is now missing, which means we're not ready to do permission checks
|
||||
$this->assertFalse(Security::database_is_ready());
|
||||
|
||||
// Rebuild the database (which re-adds the Email column), and try again
|
||||
$this->resetDBSchema(true);
|
||||
static::resetDBSchema(true);
|
||||
$this->assertTrue(Security::database_is_ready());
|
||||
|
||||
Security::$force_database_is_ready = $old;
|
||||
|
@ -15,11 +15,11 @@ use Symfony\Component\Cache\Simple\NullCache;
|
||||
|
||||
class SSViewerCacheBlockTest extends SapphireTest
|
||||
{
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SSViewerCacheBlockTest\TestModel::class
|
||||
);
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
$classes = parent::getExtraDataObjects();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class SSViewerTest extends SapphireTest
|
||||
*/
|
||||
protected $oldServer = array();
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
protected static $extra_dataobjects = array(
|
||||
SSViewerTest\TestObject::class,
|
||||
);
|
||||
|
||||
|
@ -50,7 +50,7 @@ trait i18nTestManifest
|
||||
*/
|
||||
protected $moduleManifests = 0;
|
||||
|
||||
protected function getExtraDataObjects()
|
||||
protected static function getExtraDataObjects()
|
||||
{
|
||||
return [
|
||||
TestDataObject::class,
|
||||
|
Loading…
Reference in New Issue
Block a user