Skip to content
Snippets Groups Projects
Verified Commit dccd3221 authored by Dave Long's avatar Dave Long
Browse files

Issue #3402444 by mondrake, Spokje, neclimdul, catch: Deprecate Test Suites,...

Issue #3402444 by mondrake, Spokje, neclimdul, catch: Deprecate Test Suites, no longer available in PHPUnit 10
parent 4a0bdc34
No related branches found
No related tags found
No related merge requests found
...@@ -21,12 +21,14 @@ public function testPhpUnitListTests() { ...@@ -21,12 +21,14 @@ public function testPhpUnitListTests() {
// The goal here is to successfully generate the list, without any // The goal here is to successfully generate the list, without any
// duplicate namespace errors or so forth. This keeps us from committing // duplicate namespace errors or so forth. This keeps us from committing
// tests which don't break under run-tests.sh, but do break under the // tests which don't break under run-tests.sh, but do break under the
// phpunit test runner tool. // PHPUnit CLI test runner tool.
$process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose --list-tests'); $process = Process::fromShellCommandline('vendor/bin/phpunit --configuration core --verbose --list-tests');
$process->setWorkingDirectory($this->root) $process->setWorkingDirectory($this->root)
->setTimeout(300) ->setTimeout(300)
->setIdleTimeout(300); ->setIdleTimeout(300);
$process->run(); // We disable deprecations since we do not care about them in this test,
// and deprecated classes will trigger an error when loading.
$process->run(NULL, ['SYMFONY_DEPRECATIONS_HELPER' => 'disabled']);
$this->assertEquals(0, $process->getExitCode(), $this->assertEquals(0, $process->getExitCode(),
'COMMAND: ' . $process->getCommandLine() . "\n" . 'COMMAND: ' . $process->getCommandLine() . "\n" .
'OUTPUT: ' . $process->getOutput() . "\n" . 'OUTPUT: ' . $process->getOutput() . "\n" .
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Tests\TestSuites\TestSuiteBase; use Drupal\Tests\TestSuites\TestSuiteBase;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
// The test suite class is not part of the autoloader, we need to include it // The test suite class is not part of the autoloader, we need to include it
// manually. // manually.
...@@ -19,6 +20,8 @@ ...@@ -19,6 +20,8 @@
*/ */
class TestSuiteBaseTest extends TestCase { class TestSuiteBaseTest extends TestCase {
use ExpectDeprecationTrait;
/** /**
* Helper method to set up the file system. * Helper method to set up the file system.
* *
...@@ -81,11 +84,16 @@ public function provideCoreTests() { ...@@ -81,11 +84,16 @@ public function provideCoreTests() {
/** /**
* Tests for special case behavior of unit test suite namespaces in core. * Tests for special case behavior of unit test suite namespaces in core.
* *
* @group legacy
*
* @covers ::addTestsBySuiteNamespace * @covers ::addTestsBySuiteNamespace
* *
* @dataProvider provideCoreTests * @dataProvider provideCoreTests
*/ */
public function testAddTestsBySuiteNamespaceCore($filesystem, $suite_namespace, $expected_tests) { public function testAddTestsBySuiteNamespaceCore($filesystem, $suite_namespace, $expected_tests) {
$this->expectDeprecation('Drupal\\Tests\\Core\\Test\\StubTestSuiteBase is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829');
// Set up the file system. // Set up the file system.
$vfs = vfsStream::setup('root'); $vfs = vfsStream::setup('root');
vfsStream::create($filesystem, $vfs); vfsStream::create($filesystem, $vfs);
...@@ -118,6 +126,8 @@ public function testLocalTimeZone() { ...@@ -118,6 +126,8 @@ public function testLocalTimeZone() {
* *
* We use this class to alter the behavior of TestSuiteBase so it can be * We use this class to alter the behavior of TestSuiteBase so it can be
* testable. * testable.
*
* @phpstan-ignore-next-line
*/ */
class StubTestSuiteBase extends TestSuiteBase { class StubTestSuiteBase extends TestSuiteBase {
...@@ -128,6 +138,12 @@ class StubTestSuiteBase extends TestSuiteBase { ...@@ -128,6 +138,12 @@ class StubTestSuiteBase extends TestSuiteBase {
*/ */
public $testFiles = []; public $testFiles = [];
public function __construct(string $name) {
@trigger_error(__CLASS__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
// @phpstan-ignore-next-line
parent::__construct($name);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -4,10 +4,19 @@ ...@@ -4,10 +4,19 @@
namespace Drupal\Tests\TestSuites; namespace Drupal\Tests\TestSuites;
@trigger_error('\Drupal\Tests\TestSuites\BuildTestSuite is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
require_once __DIR__ . '/TestSuiteBase.php'; require_once __DIR__ . '/TestSuiteBase.php';
/** /**
* Discovers tests for the build test suite. * Discovers tests for the build test suite.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*
* @phpstan-ignore-next-line
*/ */
class BuildTestSuite extends TestSuiteBase { class BuildTestSuite extends TestSuiteBase {
......
...@@ -4,10 +4,19 @@ ...@@ -4,10 +4,19 @@
namespace Drupal\Tests\TestSuites; namespace Drupal\Tests\TestSuites;
@trigger_error('\Drupal\Tests\TestSuites\FunctionalJavascriptTestSuite is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
require_once __DIR__ . '/TestSuiteBase.php'; require_once __DIR__ . '/TestSuiteBase.php';
/** /**
* Discovers tests for the functional-javascript test suite. * Discovers tests for the functional-javascript test suite.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*
* @phpstan-ignore-next-line
*/ */
class FunctionalJavascriptTestSuite extends TestSuiteBase { class FunctionalJavascriptTestSuite extends TestSuiteBase {
......
...@@ -4,10 +4,19 @@ ...@@ -4,10 +4,19 @@
namespace Drupal\Tests\TestSuites; namespace Drupal\Tests\TestSuites;
@trigger_error('\Drupal\Tests\TestSuites\FunctionalTestSuite is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
require_once __DIR__ . '/TestSuiteBase.php'; require_once __DIR__ . '/TestSuiteBase.php';
/** /**
* Discovers tests for the functional test suite. * Discovers tests for the functional test suite.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*
* @phpstan-ignore-next-line
*/ */
class FunctionalTestSuite extends TestSuiteBase { class FunctionalTestSuite extends TestSuiteBase {
......
...@@ -4,10 +4,19 @@ ...@@ -4,10 +4,19 @@
namespace Drupal\Tests\TestSuites; namespace Drupal\Tests\TestSuites;
@trigger_error('\Drupal\Tests\TestSuites\KernelTestSuite is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
require_once __DIR__ . '/TestSuiteBase.php'; require_once __DIR__ . '/TestSuiteBase.php';
/** /**
* Discovers tests for the kernel test suite. * Discovers tests for the kernel test suite.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*
* @phpstan-ignore-next-line
*/ */
class KernelTestSuite extends TestSuiteBase { class KernelTestSuite extends TestSuiteBase {
......
...@@ -9,9 +9,19 @@ ...@@ -9,9 +9,19 @@
/** /**
* Base class for Drupal test suites. * Base class for Drupal test suites.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*/ */
abstract class TestSuiteBase extends TestSuite { abstract class TestSuiteBase extends TestSuite {
public function __construct($theClass = '', string $name = '') {
@trigger_error(__CLASS__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
parent::__construct($theClass, $name);
}
/** /**
* Finds extensions in a Drupal installation. * Finds extensions in a Drupal installation.
* *
......
...@@ -4,10 +4,19 @@ ...@@ -4,10 +4,19 @@
namespace Drupal\Tests\TestSuites; namespace Drupal\Tests\TestSuites;
@trigger_error('\Drupal\Tests\TestSuites\UnitTestSuite is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10. See https://www.drupal.org/node/3405829', E_USER_DEPRECATED);
require_once __DIR__ . '/TestSuiteBase.php'; require_once __DIR__ . '/TestSuiteBase.php';
/** /**
* Discovers tests for the unit test suite. * Discovers tests for the unit test suite.
*
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
* replacement and test discovery will be handled differently in PHPUnit 10.
*
* @see https://www.drupal.org/node/3405829
*
* @phpstan-ignore-next-line
*/ */
class UnitTestSuite extends TestSuiteBase { class UnitTestSuite extends TestSuiteBase {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment