From: mainframe98 Date: Fri, 30 Aug 2019 15:24:41 +0000 (+0200) Subject: Permit destructors in MediaWikiTestCaseTrait::createNoOpMock X-Git-Tag: 1.34.0-rc.0~438^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin//%22%24encUrl/%22?a=commitdiff_plain;h=4941f2de91e82dce3a3e074ab5c2ae3358acb26d;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; } }