tests: mock should not __clone Database
authorAntoine Musso <hashar@free.fr>
Tue, 3 Jan 2017 16:46:29 +0000 (17:46 +0100)
committerAntoine Musso <hashar@free.fr>
Tue, 3 Jan 2017 16:48:41 +0000 (17:48 +0100)
The Database __clone relies on a connLogger which is set in the
constructor.
However, when creating a mock of Database, PHPUnit 5.x does a __clone
which uses a connLogger. That leads to a fatal error.

The sole caller is FileBackendDBRepoWrapperTest, have its mock to skip
invoking __clone().

Change-Id: I2ee3b561104bdacc0232ba5e90b3eae3fbaa6f8f

tests/phpunit/includes/filerepo/FileBackendDBRepoWrapperTest.php

index 410d2df..6c93c79 100644 (file)
@@ -113,6 +113,7 @@ class FileBackendDBRepoWrapperTest extends MediaWikiTestCase {
 
        protected function getMocks() {
                $dbMock = $this->getMockBuilder( 'DatabaseMysqli' )
+                       ->disableOriginalClone()
                        ->disableOriginalConstructor()
                        ->getMock();