Merge "Lazy load PasswordReset on SpecialPasswordReset"
[lhc/web/wiklou.git] / tests / phpunit / includes / filebackend / FileBackendTest.php
index 254cfbd..c3d31d1 100644 (file)
@@ -268,7 +268,7 @@ class FileBackendTest extends MediaWikiTestCase {
        public static function provider_testStore() {
                $cases = [];
 
-               $tmpName = TempFSFile::factory( "unittests_", 'txt' )->getPath();
+               $tmpName = TempFSFile::factory( "unittests_", 'txt', wfTempDir() )->getPath();
                $toPath = self::baseStorePath() . '/unittest-cont1/e/fun/obj1.txt';
                $op = [ 'op' => 'store', 'src' => $tmpName, 'dst' => $toPath ];
                $cases[] = [ $op ];
@@ -1786,9 +1786,9 @@ class FileBackendTest extends MediaWikiTestCase {
                $fileBContents = 'g-jmq3gpqgt3qtg q3GT ';
                $fileCContents = 'eigna[ogmewt 3qt g3qg flew[ag';
 
-               $tmpNameA = TempFSFile::factory( "unittests_", 'txt' )->getPath();
-               $tmpNameB = TempFSFile::factory( "unittests_", 'txt' )->getPath();
-               $tmpNameC = TempFSFile::factory( "unittests_", 'txt' )->getPath();
+               $tmpNameA = TempFSFile::factory( "unittests_", 'txt', wfTempDir() )->getPath();
+               $tmpNameB = TempFSFile::factory( "unittests_", 'txt', wfTempDir() )->getPath();
+               $tmpNameC = TempFSFile::factory( "unittests_", 'txt', wfTempDir() )->getPath();
                $this->addTmpFiles( [ $tmpNameA, $tmpNameB, $tmpNameC ] );
                file_put_contents( $tmpNameA, $fileAContents );
                file_put_contents( $tmpNameB, $fileBContents );
@@ -1914,7 +1914,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        // Does nothing
                ], [ 'force' => 1 ] );
 
-               $this->assertNotEquals( [], $status->errors, "Operation had warnings" );
+               $this->assertNotEquals( [], $status->getErrors(), "Operation had warnings" );
                $this->assertEquals( true, $status->isOK(), "Operation batch succeeded" );
                $this->assertEquals( 8, count( $status->success ),
                        "Operation batch has correct success array" );
@@ -2371,25 +2371,25 @@ class FileBackendTest extends MediaWikiTestCase {
 
                for ( $i = 0; $i < 25; $i++ ) {
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_SH );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->unlockFiles( $paths, LockManager::LOCK_SH );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->unlockFiles( $paths, LockManager::LOCK_EX );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName). ($i)" );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
@@ -2397,25 +2397,25 @@ class FileBackendTest extends MediaWikiTestCase {
                        # # Flip the acquire/release ordering around ##
 
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_SH );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->unlockFiles( $paths, LockManager::LOCK_EX );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName). ($i)" );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
 
                        $status = $this->backend->unlockFiles( $paths, LockManager::LOCK_SH );
-                       $this->assertEquals( print_r( [], true ), print_r( $status->errors, true ),
+                       $this->assertEquals( print_r( [], true ), print_r( $status->getErrors(), true ),
                                "Locking of files succeeded ($backendName) ($i)." );
                        $this->assertEquals( true, $status->isOK(),
                                "Locking of files succeeded with OK status ($backendName) ($i)." );
@@ -2425,7 +2425,7 @@ class FileBackendTest extends MediaWikiTestCase {
                $sl = $this->backend->getScopedFileLocks( $paths, LockManager::LOCK_EX, $status );
                $this->assertInstanceOf( 'ScopedLock', $sl,
                        "Scoped locking of files succeeded ($backendName)." );
-               $this->assertEquals( [], $status->errors,
+               $this->assertEquals( [], $status->getErrors(),
                        "Scoped locking of files succeeded ($backendName)." );
                $this->assertEquals( true, $status->isOK(),
                        "Scoped locking of files succeeded with OK status ($backendName)." );
@@ -2433,7 +2433,7 @@ class FileBackendTest extends MediaWikiTestCase {
                ScopedLock::release( $sl );
                $this->assertEquals( null, $sl,
                        "Scoped unlocking of files succeeded ($backendName)." );
-               $this->assertEquals( [], $status->errors,
+               $this->assertEquals( [], $status->getErrors(),
                        "Scoped unlocking of files succeeded ($backendName)." );
                $this->assertEquals( true, $status->isOK(),
                        "Scoped unlocking of files succeeded with OK status ($backendName)." );
@@ -2647,7 +2647,7 @@ class FileBackendTest extends MediaWikiTestCase {
                }
        }
 
-       function assertGoodStatus( $status, $msg ) {
-               $this->assertEquals( print_r( [], 1 ), print_r( $status->errors, 1 ), $msg );
+       function assertGoodStatus( StatusValue $status, $msg ) {
+               $this->assertEquals( print_r( [], 1 ), print_r( $status->getErrors(), 1 ), $msg );
        }
 }