Skip to content

Commit

Permalink
Closes #4133
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 30, 2020
1 parent 7d2ffc8 commit a07c364
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog-8.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
### Fixed

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

Expand Down
11 changes: 11 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ abstract class TestCase extends Assert implements SelfDescribing, Test
*/
private $doubledTypes = [];

/**
* @var bool
*/
private $deprecatedExpectExceptionMessageRegExpUsed = false;

/**
* Returns a matcher that matches when the method is executed
* zero or more times.
Expand Down Expand Up @@ -506,6 +511,8 @@ public function expectExceptionMessageMatches(string $regularExpression): void
*/
public function expectExceptionMessageRegExp(string $regularExpression): void
{
$this->deprecatedExpectExceptionMessageRegExpUsed = true;

$this->expectExceptionMessageMatches($regularExpression);
}

Expand Down Expand Up @@ -1447,6 +1454,10 @@ protected function runTest()
);
}

if ($this->deprecatedExpectExceptionMessageRegExpUsed) {
$this->addWarning('expectExceptionMessageRegExp() is deprecated in PHPUnit 8 and will be removed in PHPUnit 9.');
}

return;
}

Expand Down

0 comments on commit a07c364

Please sign in to comment.