mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API Deprecate PHPUnit 5.7 compatability hacks
This commit is contained in:
parent
7b0957709d
commit
a7461a8ffa
@ -378,9 +378,11 @@ abstract class BaseKernel implements Kernel
|
||||
* The purpose of this method is to avoid loading PHPUnit test files with incompatible definitions.
|
||||
*
|
||||
* @return string[] List of CI types to ignore as defined by `Module`.
|
||||
* @deprecated 5.0.0
|
||||
*/
|
||||
protected function getIgnoredCIConfigs(): array
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,10 @@ class ClassLoader
|
||||
*/
|
||||
public function init($includeTests = false, $forceRegen = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
foreach ($this->manifests as $manifest) {
|
||||
/** @var ClassManifest $instance */
|
||||
$instance = $manifest['instance'];
|
||||
|
@ -11,6 +11,7 @@ use PhpParser\ParserFactory;
|
||||
use PhpParser\ErrorHandler\ErrorHandler;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use SilverStripe\Core\Cache\CacheFactory;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
/**
|
||||
@ -280,6 +281,10 @@ class ClassManifest
|
||||
*/
|
||||
public function init($includeTests = false, $forceRegen = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
$this->cache = $this->buildCache($includeTests);
|
||||
|
||||
// Check if cache is safe to use
|
||||
@ -543,6 +548,10 @@ class ClassManifest
|
||||
*/
|
||||
public function regenerate($includeTests, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
// Reset the manifest so stale info doesn't cause errors.
|
||||
$this->loadState([]);
|
||||
$this->roots = [];
|
||||
|
@ -331,9 +331,11 @@ class Module implements Serializable
|
||||
* that is observed is `PHP`
|
||||
* @return array List of configuration aspects e.g.: `['PHP' => 'CI_PHPUNIT_NINE']`
|
||||
* @internal
|
||||
* @deprecated 5.0.0
|
||||
*/
|
||||
public function getCIConfig(): array
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
|
||||
return [
|
||||
'PHP' => $this->getPhpCiConfig()
|
||||
];
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace SilverStripe\Core\Manifest;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* Module manifest holder
|
||||
*/
|
||||
@ -95,6 +97,10 @@ class ModuleLoader
|
||||
*/
|
||||
public function init($includeTests = false, $forceRegen = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
foreach ($this->manifests as $manifest) {
|
||||
$manifest->init($includeTests, $forceRegen, $ignoredCIConfigs);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use Psr\SimpleCache\CacheInterface;
|
||||
use SilverStripe\Core\Cache\CacheFactory;
|
||||
use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* A utility class which builds a manifest of configuration items
|
||||
@ -125,6 +126,10 @@ class ModuleManifest
|
||||
*/
|
||||
public function init($includeTests = false, $forceRegen = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
// build cache from factory
|
||||
if ($this->cacheFactory) {
|
||||
$this->cache = $this->cacheFactory->create(
|
||||
@ -167,6 +172,10 @@ class ModuleManifest
|
||||
*/
|
||||
public function regenerate($includeTests = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
$this->modules = [];
|
||||
|
||||
$finder = new ManifestFileFinder();
|
||||
|
@ -6,6 +6,7 @@ use PHPUnit_Framework_Constraint;
|
||||
use PHPUnit_Framework_ExpectationFailedException;
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\SSListExporter;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
@ -190,6 +191,8 @@ class SSListContains extends PHPUnit_Framework_Constraint implements TestOnly
|
||||
|
||||
public function __construct($matches)
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This class will be removed in CMS 5', Deprecation::SCOPE_CLASS);
|
||||
|
||||
$this->exporter = new SSListExporter();
|
||||
|
||||
$this->matches = $matches;
|
||||
|
@ -6,6 +6,7 @@ use PHPUnit_Framework_Constraint;
|
||||
use PHPUnit_Framework_ExpectationFailedException;
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\SSListExporter;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
@ -135,6 +136,7 @@ class SSListContainsOnlyMatchingItems extends PHPUnit_Framework_Constraint imple
|
||||
|
||||
public function __construct($match)
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This class will be removed in CMS 5', Deprecation::SCOPE_CLASS);
|
||||
$this->exporter = new SSListExporter();
|
||||
|
||||
$this->constraint = new ViewableDataContains($match);
|
||||
|
@ -7,6 +7,7 @@ use PHPUnit_Framework_ExpectationFailedException;
|
||||
use PHPUnit_Util_InvalidArgumentHelper;
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\View\ViewableData;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
@ -141,6 +142,7 @@ class ViewableDataContains extends PHPUnit_Framework_Constraint implements TestO
|
||||
*/
|
||||
public function __construct($match)
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This class will be removed in CMS 5', Deprecation::SCOPE_CLASS);
|
||||
parent::__construct();
|
||||
if (!is_array($match)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(
|
||||
|
@ -546,6 +546,8 @@ class FunctionalTest extends SapphireTest implements TestOnly
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This class will be removed in CMS 5', Deprecation::SCOPE_CLASS);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// Skip calling FunctionalTest directly.
|
||||
|
@ -1619,6 +1619,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This class will be removed in CMS 5', Deprecation::SCOPE_CLASS);
|
||||
|
||||
if (!defined('FRAMEWORK_PATH')) {
|
||||
trigger_error(
|
||||
'Missing constants, did you remember to include the test bootstrap in your phpunit.xml file?',
|
||||
|
@ -53,12 +53,16 @@ class TestKernel extends CoreKernel
|
||||
*/
|
||||
public function setIgnoredCIConfigs(array $ciConfigs): self
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
|
||||
|
||||
$this->ciConfigs = $ciConfigs;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getIgnoredCIConfigs(): array
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
|
||||
|
||||
return $this->ciConfigs;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ use Psr\SimpleCache\CacheInterface;
|
||||
use SilverStripe\Core\Cache\CacheFactory;
|
||||
use SilverStripe\Core\Manifest\ManifestFileFinder;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* A class which builds a manifest of all themes (which is really just a directory called "templates")
|
||||
@ -77,6 +78,10 @@ class ThemeManifest implements ThemeList
|
||||
*/
|
||||
public function init($includeTests = false, $forceRegen = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
// build cache from factory
|
||||
if ($this->cacheFactory) {
|
||||
$this->cache = $this->cacheFactory->create(
|
||||
@ -134,6 +139,10 @@ class ThemeManifest implements ThemeList
|
||||
*/
|
||||
public function regenerate($includeTests = false, array $ignoredCIConfigs = [])
|
||||
{
|
||||
if (!empty($ignoredCIConfigs)) {
|
||||
Deprecation::notice('5.0.0', 'The $ignoredCIConfigs parameter will be removed in CMS 5');
|
||||
}
|
||||
|
||||
$finder = new ManifestFileFinder();
|
||||
$finder->setOptions([
|
||||
'include_themes' => false,
|
||||
|
Loading…
Reference in New Issue
Block a user