Permit destructors in MediaWikiTestCaseTrait::createNoOpMock
authormainframe98 <k.s.werf@hotmail.com>
Fri, 30 Aug 2019 15:24:41 +0000 (17:24 +0200)
committerMainframe98 <k.s.werf@hotmail.com>
Fri, 30 Aug 2019 15:27:38 +0000 (15:27 +0000)
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

index f047d82..4ccfe39 100644 (file)
@@ -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;
        }
 }