Skip to content
Snippets Groups Projects
Unverified Commit eb1adb0b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3252257 by Spokje, beatrizrodrigues, longwave, paulocs, mondrake: Remove PHPUnit 8 support

parent 934f42ae
No related branches found
No related tags found
38 merge requests!7471uncessary 5 files are moved from media-library folder to misc folder,!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4289Issue #1344552 by marcingy, Niklas Fiekas, Ravi.J, aleevas, Eduardo Morales...,!4114Issue #2707291: Disable body-level scrolling when a dialog is open as a modal,!3630Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create...,!3291Issue #3336463: Rewrite rules for gzipped CSS and JavaScript aggregates never match,!3143Issue #3313342: [PHP 8.1] Deprecated function: strpos(): Passing null to parameter #1 LayoutBuilderUiCacheContext.php on line 28,!3102Issue #3164428 by DonAtt, longwave, sahil.goyal, Anchal_gupta, alexpott: Use...,!2853#3274419 Makes BaseFieldOverride inherit the internal property from the base field.,!2719Issue #3110137: Remove Classy from core.,!2437Issue #3238257 by hooroomoo, Wim Leers: Fragment link pointing to <textarea>...,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2074Issue #2707689: NodeForm::actions() checks for delete access on new entities,!2062Issue #3246454: Add weekly granularity to views date sort,!1974Issue #3036862 demonstration,!1591Issue #3199697: Add JSON:API Translation experimental module,!1484Exposed filters get values from URL when Ajax is on,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1254Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS,!1162Issue #3100350: Unable to save '/' root path alias,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!957Added throwing of InvalidPluginDefinitionException from getDefinition().,!925Issue #2339235: Remove taxonomy hard dependency on node module,!877Issue #2708101: Default value for link text is not saved,!873Issue #2875228: Site install not using batch API service,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!844Resolve #3036010 "Updaters",!712Issue #2909128: Autocomplete intermittent on Chrome Android,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
Showing with 7 additions and 142 deletions
......@@ -48,7 +48,6 @@ class Config {
'phpspec/prophecy' => ['fixtures', 'spec', 'tests'],
'phpunit/php-code-coverage' => ['tests'],
'phpunit/php-timer' => ['tests'],
'phpunit/php-token-stream' => ['tests'],
'phpunit/phpunit' => ['tests'],
'sebastian/code-unit-reverse-lookup' => ['tests'],
'sebastian/comparator' => ['tests'],
......
......@@ -44,7 +44,6 @@ class Composer {
'phpspec/prophecy' => ['fixtures', 'spec', 'tests'],
'phpunit/php-code-coverage' => ['tests'],
'phpunit/php-timer' => ['tests'],
'phpunit/php-token-stream' => ['tests'],
'phpunit/phpunit' => ['tests'],
'sebastian/code-unit-reverse-lookup' => ['tests'],
'sebastian/comparator' => ['tests'],
......
......@@ -7,7 +7,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Test\Exception\MissingGroupException;
use Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter;
use Drupal\TestTools\PhpUnitCompatibility\ClassWriter;
use PHPUnit\Util\Test;
/**
......
......@@ -18,7 +18,7 @@
use Drupal\Core\Test\TestDatabase;
use Drupal\Core\Test\TestRunnerKernel;
use Drupal\Core\Test\TestDiscovery;
use Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter;
use Drupal\TestTools\PhpUnitCompatibility\ClassWriter;
use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\Version;
use Symfony\Component\Console\Output\ConsoleOutput;
......
<?php
namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit8;
namespace Drupal\TestTools\PhpUnitCompatibility;
use Composer\Autoload\ClassLoader;
......
<?php
namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit8;
/**
* Drupal's forward compatibility layer with multiple versions of PHPUnit.
*/
trait TestCompatibilityTrait {
}
......@@ -5,7 +5,6 @@
use Drupal\Composer\Plugin\VendorHardening\Config;
use Drupal\Core\Composer\Composer;
use Drupal\Tests\Composer\ComposerIntegrationTrait;
use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;
use Symfony\Component\Yaml\Yaml;
/**
......@@ -266,11 +265,6 @@ public function testVendorCleanup($class, $property) {
$reflection = new \ReflectionProperty($class, $property);
$reflection->setAccessible(TRUE);
$config = $reflection->getValue();
// PHPUnit 9.5.3 removes 'phpunit/php-token-stream' from its dependencies.
// @todo remove the check below when PHPUnit 9 is the minimum.
if (RunnerVersion::getMajor() >= 9) {
unset($config['phpunit/php-token-stream']);
}
foreach (array_keys($config) as $package) {
$this->assertContains(strtolower($package), $packages);
}
......
......@@ -125,12 +125,10 @@ public static function getSkippedDeprecations() {
// testing using \Symfony\Component\ErrorHandler\DebugClassLoader.
'The "Twig\Environment::getTemplateClass()" method is considered internal. It may change without further notice. You should not extend it from "Drupal\Core\Template\TwigEnvironment".',
'"Symfony\Component\DomCrawler\Crawler::text()" will normalize whitespaces by default in Symfony 5.0, set the second "$normalizeWhitespace" argument to false to retrieve the non-normalized version of the text.',
// PHPUnit 8.
"The \"PHPUnit\TextUI\ResultPrinter\" 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\Listeners\HtmlOutputPrinter\".",
// PHPUnit 9.
"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\".",
// PHPUnit 9.
"The \"PHPUnit\TextUI\DefaultResultPrinter\" 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\Listeners\HtmlOutputPrinter\".",
];
}
......
......@@ -2,27 +2,15 @@
namespace Drupal\Tests\Listeners;
use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;
use PHPUnit\Framework\TestResult;
// In order to manage different implementations across PHPUnit versions, we
// dynamically load the base ResultPrinter class dependent on the PHPUnit runner
// version.
if (!class_exists(ResultPrinterBase::class, FALSE)) {
if (RunnerVersion::getMajor() < 9) {
class_alias('PHPUnit\TextUI\ResultPrinter', ResultPrinterBase::class);
}
else {
class_alias('PHPUnit\TextUI\DefaultResultPrinter', ResultPrinterBase::class);
}
}
use PHPUnit\TextUI\DefaultResultPrinter;
/**
* Defines a class for providing html output results for functional tests.
*
* @internal
*/
class HtmlOutputPrinter extends ResultPrinterBase {
class HtmlOutputPrinter extends DefaultResultPrinter {
use HtmlOutputPrinterTrait;
......
......@@ -2,8 +2,6 @@
namespace Drupal\Tests;
use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;
/**
* @coversDefaultClass \Drupal\Tests\Traits\PhpUnitWarnings
* @group legacy
......@@ -18,105 +16,4 @@ public function testAddWarning() {
$this->addWarning('Test warning for \Drupal\Tests\PhpUnitWarningsTest::testAddWarning()');
}
/**
* Tests assertContains.
*/
public function testAssertContains() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, argument 2 passed to PHPUnit\Framework\Assert::assertContains() must be iterable.");
}
$this->expectDeprecation('Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.');
$this->expectDeprecation('The optional $ignoreCase parameter of assertContains() is deprecated and will be removed in PHPUnit 9.');
$this->assertContains('string', 'aaaa_string_aaa');
$this->assertContains('STRING', 'aaaa_string_aaa', '', TRUE);
}
/**
* Tests assertNotContains.
*/
public function testAssertNotContains() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, argument 2 passed to PHPUnit\Framework\Assert::assertNotContains() must be iterable.");
}
$this->expectDeprecation('Using assertNotContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringNotContainsString() or assertStringNotContainsStringIgnoringCase() instead.');
$this->expectDeprecation('The optional $ignoreCase parameter of assertNotContains() is deprecated and will be removed in PHPUnit 9.');
$this->assertNotContains('foo', 'bar');
$this->assertNotContains('FOO', 'bar', '', TRUE);
}
/**
* Tests assertArraySubset.
*/
public function testAssertArraySubset() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, assertArraySubset() is removed.");
}
$this->expectDeprecation('assertArraySubset() is deprecated and will be removed in PHPUnit 9.');
$this->assertArraySubset(['a'], ['a', 'b']);
}
/**
* Tests assertInternalType.
*/
public function testAssertInternalType() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, assertInternalType() is removed.");
}
$this->expectDeprecation('assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsString() instead.');
$this->assertInternalType('string', 'string');
}
/**
* Tests assertion methods accessing class attributes.
*/
public function testAssertAttribute() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, assertion methods accessing class attributes are removed.");
}
$this->expectDeprecation('assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.');
$this->expectDeprecation('readAttribute() is deprecated and will be removed in PHPUnit 9.');
$this->expectDeprecation('getObjectAttribute() is deprecated and will be removed in PHPUnit 9.');
$this->expectDeprecation('assertAttributeSame() is deprecated and will be removed in PHPUnit 9.');
$this->expectDeprecation('assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.');
$this->expectDeprecation('assertAttributeEmpty() is deprecated and will be removed in PHPUnit 9.');
$obj = new class() {
protected $attribute = 'value';
protected $class;
protected $empty;
public function __construct() {
$this->class = new \stdClass();
}
};
$this->assertAttributeEquals('value', 'attribute', $obj);
$this->assertAttributeSame('value', 'attribute', $obj);
$this->assertAttributeInstanceOf(\stdClass::class, 'class', $obj);
$this->assertAttributeEmpty('empty', $obj);
}
/**
* Tests assertEquals.
*/
public function testAssertEquals() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, the \$canonicalize parameter of assertEquals() is removed.");
}
$this->expectDeprecation('The optional $canonicalize parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsCanonicalizing() instead.');
$this->assertEquals(['a', 'b'], ['b', 'a'], '', 0.0, 10, TRUE);
}
/**
* Tests expectExceptionMessageRegExp.
*/
public function testExpectExceptionMessageRegExp() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, expectExceptionMessageRegExp() is removed.");
}
$this->expectDeprecation('expectExceptionMessageRegExp() is deprecated in PHPUnit 8 and will be removed in PHPUnit 9. Use expectExceptionMessageMatches() instead.');
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/An exception .*/');
throw new \Exception('An exception has been triggered');
}
}
......@@ -8,7 +8,7 @@
*/
use Drupal\Component\Assertion\Handle;
use Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter;
use Drupal\TestTools\PhpUnitCompatibility\ClassWriter;
/**
* Finds all valid extension directories recursively within a given directory.
......
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