Issue #3122961 by mondrake: PHPUnit\Framework\TestCase::__construct() should not be extended
parent
6964f09b96
commit
363a6611be
|
@ -76,6 +76,8 @@ abstract class InstallerTestBase extends BrowserTestBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUpAppRoot();
|
||||
|
||||
$this->isInstalled = FALSE;
|
||||
|
||||
$this->setupBaseUrl();
|
||||
|
|
|
@ -117,18 +117,6 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
|||
*/
|
||||
protected $strictConfigSchema = FALSE;
|
||||
|
||||
/**
|
||||
* Constructs an UpdatePathTestCase object.
|
||||
*
|
||||
* @param $test_id
|
||||
* (optional) The ID of the test. Tests with the same id are reported
|
||||
* together.
|
||||
*/
|
||||
public function __construct($test_id = NULL) {
|
||||
parent::__construct($test_id);
|
||||
$this->zlibInstalled = function_exists('gzopen');
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides WebTestBase::setUp() for update testing.
|
||||
*
|
||||
|
@ -138,6 +126,9 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
|||
* container that would normally be done via the installer.
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUpAppRoot();
|
||||
$this->zlibInstalled = function_exists('gzopen');
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
// Boot up Drupal into a state where calling the database API is possible.
|
||||
|
|
|
@ -212,15 +212,6 @@ abstract class BrowserTestBase extends TestCase {
|
|||
*/
|
||||
protected $originalContainer;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($name = NULL, array $data = [], $dataName = '') {
|
||||
parent::__construct($name, $data, $dataName);
|
||||
|
||||
$this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes Mink sessions.
|
||||
*/
|
||||
|
@ -397,6 +388,8 @@ abstract class BrowserTestBase extends TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->setUpAppRoot();
|
||||
|
||||
// Allow tests to compare MarkupInterface objects via assertEquals().
|
||||
$this->registerComparator(new MarkupInterfaceComparator());
|
||||
|
||||
|
@ -418,6 +411,15 @@ abstract class BrowserTestBase extends TestCase {
|
|||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the root application path.
|
||||
*/
|
||||
protected function setUpAppRoot(): void {
|
||||
if ($this->root === NULL) {
|
||||
$this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures test files are deletable.
|
||||
*
|
||||
|
|
|
@ -174,8 +174,6 @@ trait DeprecationListenerTrait {
|
|||
"The \"Drupal\Tests\Listeners\DrupalListener\" class implements \"PHPUnit\Framework\TestListener\" that is deprecated Use the `TestHook` interfaces instead.",
|
||||
"The \"Drupal\Tests\Listeners\DrupalListener\" class uses \"PHPUnit\Framework\TestListenerDefaultImplementation\" that is deprecated The `TestListener` interface is deprecated.",
|
||||
"The \"PHPUnit\Framework\TestSuite\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\TestSuites\TestSuiteBase\".",
|
||||
"The \"PHPUnit\Framework\TestCase::__construct()\" method is considered internal This method is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not extend it from \"Drupal\Tests\BrowserTestBase\".",
|
||||
"The \"PHPUnit\Framework\TestCase::__construct()\" method is considered internal This method is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not extend it from \"Drupal\FunctionalTests\Update\UpdatePathTestBase\".",
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue