Skip to content

Commit a07c364

Browse files
Closes #4133
1 parent 7d2ffc8 commit a07c364

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ChangeLog-8.5.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
77
### Fixed
88

99
* [#4017](https://github.com/sebastianbergmann/phpunit/issues/4017): Do not suggest refactoring to something that is also deprecated
10+
* [#4133](https://github.com/sebastianbergmann/phpunit/issues/4133): `expectExceptionMessageRegExp()` has been removed in PHPUnit 9 without a deprecation warning being given in PHPUnit 8
1011
* [#4139](https://github.com/sebastianbergmann/phpunit/issues/4139): Cannot double interfaces that declare a constructor with PHP 8
1112
* [#4144](https://github.com/sebastianbergmann/phpunit/issues/4144): Empty objects are converted to empty arrays in JSON comparison failure diff
1213

src/Framework/TestCase.php

+11
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ abstract class TestCase extends Assert implements SelfDescribing, Test
269269
*/
270270
private $doubledTypes = [];
271271

272+
/**
273+
* @var bool
274+
*/
275+
private $deprecatedExpectExceptionMessageRegExpUsed = false;
276+
272277
/**
273278
* Returns a matcher that matches when the method is executed
274279
* zero or more times.
@@ -506,6 +511,8 @@ public function expectExceptionMessageMatches(string $regularExpression): void
506511
*/
507512
public function expectExceptionMessageRegExp(string $regularExpression): void
508513
{
514+
$this->deprecatedExpectExceptionMessageRegExpUsed = true;
515+
509516
$this->expectExceptionMessageMatches($regularExpression);
510517
}
511518

@@ -1447,6 +1454,10 @@ protected function runTest()
14471454
);
14481455
}
14491456

1457+
if ($this->deprecatedExpectExceptionMessageRegExpUsed) {
1458+
$this->addWarning('expectExceptionMessageRegExp() is deprecated in PHPUnit 8 and will be removed in PHPUnit 9.');
1459+
}
1460+
14501461
return;
14511462
}
14521463

0 commit comments

Comments
 (0)