Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#5 | 3098199-5-set-expected-exception.patch | 7.13 KB | TR |
|
Comments
Comment #2
TR CreditAttribution: TR commentedSee #3096756: setExpectedException() is deprecated : Remove support for PHPUnit 4 when Drupal 8.8 becomes the lowest supported version - this can't be done until core 8.7.x become unsupported ~June 2020.
Comment #3
TR CreditAttribution: TR commentedComment #4
TR CreditAttribution: TR commentedI'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.
Comment #5
TR CreditAttribution: TR commentedComment #7
TR CreditAttribution: TR commentedCommitted.
Comment #8
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThank you TR. It's good to finally be able to get this done.