We need to replace the use of $this->setExpectedException with $this->expectException and $this->expectExceptionMessage. This is due to support for PHPUnit 4 being removed.

8x: \Drupal\Tests\PhpunitCompatibilityTrait:setExpectedException() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Backward compatibility for PHPUnit 4 will no longer be supported. See https://www.drupal.org/node/3056869

The 8 ocurrences are:

Unit\ContextHandlerTraitTest::testMissingContext
Unit\Integration\Action\DataConvertTest::testInvalidValueException
Unit\Integration\Action\DataConvertTest::testInvalidRoundingBehavior
Unit\Integration\Action\DataConvertTest::testInvalidRoundingBehaviorException
Unit\Integration\Action\DataConvertTest::testInvalidTargetTypeException
Unit\Integration\Condition\UserHasRoleTest::testInvalidOperationException
Unit\Integration\Engine\LoopTest::testOutOfScopeVariableExecution
Unit\RulesActionBaseTest::testSummaryThrowingException

Original issue: #3059090: Deprecate \Drupal\Tests\PhpunitCompatibilityTrait::setExpectedException()
Change record: https://www.drupal.org/node/3056869

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055 created an issue. See original summary.

TR’s picture

TR’s picture

Title: Replace deprecated $this->setExpectedException » Replace deprecated $this->setExpectedException when Drupal 8.8 becomes the lowest supported version
TR’s picture

Status: Active » Postponed

I'm going to postpone this because it's going to be a long time before we can do this. I'll re-open it ~1 month ahead of time so that we can work on a patch at that time.

TR’s picture

Status: Postponed » Needs review
FileSize
7.13 KB

  • TR committed 6f1ffbd on 8.x-3.x
    Issue #3098199 by TR: Replace deprecated $this->setExpectedException...
TR’s picture

Status: Needs review » Fixed

Committed.

jonathan1055’s picture

Thank you TR. It's good to finally be able to get this done.

Status: Fixed » Closed (fixed)

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