Problem/Motivation

Support for using expectException() with PHPUnit\\Framework\\Error\\Error is deprecated and will be removed in PHPUnit 10. Use expectError() instead.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Title: Replace usages of expectException(Warning::class), that is deprecated » Replace usages of expectException(Error::class), that is deprecated
sudiptadas19’s picture

Status: Active » Needs review
StatusFileSize
new3.96 KB

Added patch. Please review it.

vikashsoni’s picture

@sudiptadas19 --- this patch giving error while trying to apply

Checking patch core/tests/Drupal/Tests/Core/Database/ConditionTest.php...
Checking patch core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php...
Checking patch core/tests/Drupal/Tests/Core/Render/ElementTest.php...
Checking patch core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php...
error: while searching for:
'assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.',
'assertNotRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDoesNotMatchRegularExpression() instead.',
'Support for using expectException() with PHPUnit\\Framework\\Error\\Warning is deprecated and will be removed in PHPUnit 10. Use expectWarning() instead.',
'Support for using expectException() with PHPUnit\\Framework\\Error\\Error is deprecated and will be removed in PHPUnit 10. Use expectError() instead.',
'assertDirectoryNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDirectoryIsNotWritable() instead.',
'assertFileNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileIsNotWritable() instead.',
'The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked.',

error: patch failed: core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php:129
error: core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php: patch does not apply

mondrake’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/Core/Render/ElementTest.php
@@ -107,7 +107,7 @@ public function testInvalidChildren() {
     $this->expectExceptionMessage('"foo" is an invalid render array key');

this should be converted to expectErrorMessage()

sudiptadas19’s picture

@mondrake I have did the changes as per the issue summary, for your suggestive changes the issue summary needs to be updated.

sudiptadas19’s picture

Added a new tag for issue summary update.

meenakshi_j’s picture

StatusFileSize
new4.76 KB

#4 patch is working fine.
Fixed the custom commands.

meenakshi_j’s picture

Status: Needs work » Needs review
sudiptadas19’s picture

StatusFileSize
new4.83 KB
new1.87 KB

Added mentioned changes, also provide an interdiff file for better understanding changes.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update

RTBC. The PHP 7.3 test is green, indicating tests run OK on PHPUnit8. Deprecation silencer removed and all conversions done.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a re-roll.

hmendes’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new4.69 KB

Re-rolling.
Changing it back to needs review as I didn't test it, just re-rolled.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Already needs another re-roll sorry. On the plus side we're running out of this batch of conflicting patches.

guilhermevp’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new6.26 KB

Re-rolled patch!

quietone’s picture

Status: Needs review » Needs work
sudiptadas19’s picture

Status: Needs work » Needs review
StatusFileSize
new4.67 KB

Re-rolled patch!

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

  • catch committed ee93cbc on 9.3.x
    Issue #3217716 by sudiptadas19, Meenakshi_j, hmendes, guilhermevp,...

  • catch committed ae21ac5 on 9.2.x
    Issue #3217716 by sudiptadas19, Meenakshi_j, hmendes, guilhermevp,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.3.x and also to 9.2.x without the deprecation suppression removal.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.