From 4941f2de91e82dce3a3e074ab5c2ae3358acb26d Mon Sep 17 00:00:00 2001 From: mainframe98 Date: Fri, 30 Aug 2019 17:24:41 +0200 Subject: [PATCH] Permit destructors in MediaWikiTestCaseTrait::createNoOpMock 709773ab5747 introduced this method, but its implementation does not permit calls to __destruct. PHP documentation on destructors says that they'll be called unconditionally, which makes using the mock created with this method unusable for classes that implement __destruct. Bug: T231656 Change-Id: Icb4f978c78e726401d75627128c9c76f6f9afc87 --- tests/phpunit/MediaWikiTestCaseTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/MediaWikiTestCaseTrait.php b/tests/phpunit/MediaWikiTestCaseTrait.php index f047d826b5..4ccfe39491 100644 --- a/tests/phpunit/MediaWikiTestCaseTrait.php +++ b/tests/phpunit/MediaWikiTestCaseTrait.php @@ -26,7 +26,7 @@ trait MediaWikiTestCaseTrait { */ protected function createNoOpMock( $type ) { $mock = $this->createMock( $type ); - $mock->expects( $this->never() )->method( $this->anything() ); + $mock->expects( $this->never() )->method( $this->anythingBut( '__destruct' ) ); return $mock; } } -- 2.20.1