Skip to content

Commit

Permalink
Merge pull request #90 from Yoast/feature/phpunit-10-tweak-test-expec…
Browse files Browse the repository at this point in the history
…tations

AssertClosedResource* Tests: update exception message expectation
  • Loading branch information
jrfnl authored Mar 10, 2023
2 parents 686f13b + 86657f3 commit 4485b06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/Polyfills/AssertClosedResourceNotResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class AssertClosedResourceNotResourceTest extends TestCase {
* @return void
*/
public function testAssertIsClosedResource( $value ) {
$pattern = '`^Failed asserting that .+? is of type "resource \(closed\)"`s';
$pattern = '`^Failed asserting that .+? is of type ["]?resource \(closed\)["]?`s';
$exception = 'PHPUnit\Framework\AssertionFailedError';
if ( \class_exists( 'PHPUnit_Framework_AssertionFailedError' ) ) {
// PHPUnit < 6.
Expand Down
4 changes: 2 additions & 2 deletions tests/Polyfills/AssertClosedResourceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class AssertClosedResourceTestCase extends TestCase {
* @return void
*/
public function isClosedResourceExpectExceptionOnOpenResource( $actual ) {
$pattern = '`^Failed asserting that .+? is of type "resource \(closed\)"`';
$pattern = '`^Failed asserting that .+? is of type ["]?resource \(closed\)["]?`';
$exception = 'PHPUnit\Framework\AssertionFailedError';
if ( \class_exists( 'PHPUnit_Framework_AssertionFailedError' ) ) {
// PHPUnit < 6.
Expand All @@ -49,7 +49,7 @@ public function isNotClosedResourceExpectExceptionOnClosedResource( $actual ) {
* PHPUnit itself will report closed resources as `NULL` prior to Exporter 3.0.4/4.1.4.
* See: https://github.com/sebastianbergmann/exporter/pull/37
*/
$pattern = '`^Failed asserting that (resource \(closed\)|NULL) is not of type "resource \(closed\)"`';
$pattern = '`^Failed asserting that (resource \(closed\)|NULL) is not of type ["]?resource \(closed\)["]?`';
$exception = 'PHPUnit\Framework\AssertionFailedError';
if ( \class_exists( 'PHPUnit_Framework_AssertionFailedError' ) ) {
// PHPUnit < 6.
Expand Down

0 comments on commit 4485b06

Please sign in to comment.