tests: Replace PHPUnit's loose assertEquals(false) with assertFalse()

assertEquals( false, … ) still succeeds when the actual value is 0, null,
an empty string, even an empty array. All these should be reported as a
failure, I would argue.

Note this patch previously also touched assertSame( false ). I reverted
these. The only benefit would have been consistency within this codebase,
but there is no strict reason to prefer one over the other. assertFalse()
and assertSame( false ) are functionally identical.

Change-Id: Ic5f1c7d504e7249002d3184520012e03313137b4
This commit is contained in:
Thiemo Kreuz 2019-09-17 16:19:26 +02:00 committed by Krinkle
parent 58d368db58
commit e4272518f7
21 changed files with 96 additions and 100 deletions

View file

@ -260,8 +260,7 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
$request->getAllHeaders()
);
$this->assertEquals(
false,
$this->assertFalse(
$request->getHeader( 'test' )
);
}

View file

@ -66,11 +66,11 @@ class GitInfoTest extends MediaWikiTestCase {
$this->assertFalse( $fixture->cacheIsComplete() );
$this->assertEquals( false, $fixture->getHead() );
$this->assertEquals( false, $fixture->getHeadSHA1() );
$this->assertEquals( false, $fixture->getHeadCommitDate() );
$this->assertEquals( false, $fixture->getCurrentBranch() );
$this->assertEquals( false, $fixture->getHeadViewUrl() );
$this->assertFalse( $fixture->getHead() );
$this->assertFalse( $fixture->getHeadSHA1() );
$this->assertFalse( $fixture->getHeadCommitDate() );
$this->assertFalse( $fixture->getCurrentBranch() );
$this->assertFalse( $fixture->getHeadViewUrl() );
// After calling all the outputs, the cache should be complete
$this->assertTrue( $fixture->cacheIsComplete() );

View file

@ -477,7 +477,7 @@ class GlobalTest extends MediaWikiTestCase {
$conflictingMerge = wfMerge( 'old', 'old and mine', 'old and yours', $mergedText );
$this->assertEquals( true, $successfulMerge );
$this->assertEquals( false, $conflictingMerge );
$this->assertFalse( $conflictingMerge );
}
/**

View file

@ -552,7 +552,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'badaccess-group0' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'bogus', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()
->userCan( 'bogus', $this->user, $this->title ) );
}
@ -931,11 +931,11 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->title->mCascadeRestriction = true;
$this->overrideUserPermissions( $this->user, "edit" );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()
->quickUserCan( 'bogus', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->quickUserCan(
'edit', $this->user, $this->title ) );
@ -952,11 +952,11 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
'edit', $this->user, $this->title ) );
$this->overrideUserPermissions( $this->user, [ "edit", "editprotected" ] );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->quickUserCan(
'bogus', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->quickUserCan(
'edit', $this->user, $this->title ) );
@ -988,7 +988,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
"bogus" => [ 'bogus', "sysop", "protect", "" ]
];
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'bogus', $this->user, $this->title ) );
$this->assertEquals( [
@ -1023,7 +1023,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'create', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'create', $this->user, $this->title ) );
@ -1032,7 +1032,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'create', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'create', $this->user, $this->title ) );
@ -1048,13 +1048,13 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'create', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'create', $this->user, $this->title ) );
$this->setTitle( NS_MEDIA, "test page" );
$this->overrideUserPermissions( $this->user, [ "move" ] );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'move', $this->user, $this->title ) );
$this->assertEquals( [ [ 'immobile-source-namespace', 'Media' ] ],
@ -1073,12 +1073,12 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'immobile-source-page' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'move', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'move', $this->user, $this->title ) );
$this->setTitle( NS_MEDIA, "test page" );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'move-target', $this->user, $this->title ) );
$this->assertEquals( [ [ 'immobile-target-namespace', 'Media' ] ],
@ -1097,7 +1097,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'immobile-target-page' ] ],
MediaWikiServices::getInstance()->getPermissionManager()
->getPermissionErrors( 'move-target', $this->user, $this->title ) );
$this->assertEquals( false,
$this->assertFalse(
MediaWikiServices::getInstance()->getPermissionManager()->userCan(
'move-target', $this->user, $this->title ) );
}
@ -1171,7 +1171,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
MediaWikiServices::getInstance()->getPermissionManager()->getPermissionErrors(
'move-target', $this->user, $this->title ) );
$this->assertEquals( false, MediaWikiServices::getInstance()->getPermissionManager()
$this->assertFalse( MediaWikiServices::getInstance()->getPermissionManager()
->userCan( 'move-target', $this->user, $this->title ) );
// quickUserCan should ignore user blocks
$this->assertEquals( true, MediaWikiServices::getInstance()->getPermissionManager()

View file

@ -629,7 +629,7 @@ class StatusTest extends MediaWikiLangTestCase {
return '-' . $value . '-';
};
$status->__wakeup();
$this->assertEquals( false, $status->cleanCallback );
$this->assertFalse( $status->cleanCallback );
}
/**

View file

@ -448,7 +448,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->overrideUserPermissions( $this->user );
$this->assertEquals( [ [ 'badaccess-group0' ] ],
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'bogus', $this->user ) );
}
@ -748,9 +748,9 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->title->mCascadeRestriction = true;
$this->overrideUserPermissions( $this->user, "edit" );
$this->assertEquals( false,
$this->assertFalse(
$this->title->quickUserCan( 'bogus', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->quickUserCan( 'edit', $this->user ) );
$this->assertEquals( [ [ 'badaccess-group0' ],
[ 'protectedpagetext', 'bogus', 'bogus' ],
@ -765,9 +765,9 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->user ) );
$this->overrideUserPermissions( $this->user, [ "edit", "editprotected" ] );
$this->assertEquals( false,
$this->assertFalse(
$this->title->quickUserCan( 'bogus', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->quickUserCan( 'edit', $this->user ) );
$this->assertEquals( [ [ 'badaccess-group0' ],
[ 'protectedpagetext', 'bogus', 'bogus' ],
@ -797,7 +797,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
"bogus" => [ 'bogus', "sysop", "protect", "" ]
];
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'bogus', $this->user ) );
$this->assertEquals( [
[ "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n", 'bogus' ],
@ -827,14 +827,14 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
$this->title->getUserPermissionsErrors( 'create', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'create', $this->user ) );
$this->title->mTitleProtection['permission'] = 'editprotected';
$this->overrideUserPermissions( $this->user, [ 'createpage', 'protect' ] );
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
$this->title->getUserPermissionsErrors( 'create', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'create', $this->user ) );
$this->overrideUserPermissions( $this->user, [ 'createpage', 'editprotected' ] );
@ -846,12 +846,12 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->overrideUserPermissions( $this->user, [ 'createpage' ] );
$this->assertEquals( [ [ 'titleprotected', 'Useruser', 'test' ] ],
$this->title->getUserPermissionsErrors( 'create', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'create', $this->user ) );
$this->setTitle( NS_MEDIA, "test page" );
$this->overrideUserPermissions( $this->user, [ "move" ] );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'move', $this->user ) );
$this->assertEquals( [ [ 'immobile-source-namespace', 'Media' ] ],
$this->title->getUserPermissionsErrors( 'move', $this->user ) );
@ -865,11 +865,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->title->mInterwiki = "no";
$this->assertEquals( [ [ 'immobile-source-page' ] ],
$this->title->getUserPermissionsErrors( 'move', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'move', $this->user ) );
$this->setTitle( NS_MEDIA, "test page" );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'move-target', $this->user ) );
$this->assertEquals( [ [ 'immobile-target-namespace', 'Media' ] ],
$this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
@ -883,7 +883,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->title->mInterwiki = "no";
$this->assertEquals( [ [ 'immobile-target-page' ] ],
$this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
$this->assertEquals( false,
$this->assertFalse(
$this->title->userCan( 'move-target', $this->user ) );
}
@ -942,7 +942,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
$this->title->getUserPermissionsErrors( 'move-target',
$this->user ) );
$this->assertEquals( false, $this->title->userCan( 'move-target', $this->user ) );
$this->assertFalse( $this->title->userCan( 'move-target', $this->user ) );
// quickUserCan should ignore user blocks
$this->assertEquals( true, $this->title->quickUserCan( 'move-target', $this->user ) );

View file

@ -765,8 +765,7 @@ class TitleTest extends MediaWikiTestCase {
$linkCache->clearLink( $title );
$linkCache->addBadLinkObj( $title );
$this->assertEquals(
false,
$this->assertFalse(
$title->exists(),
'exists() should rely on link cache unless READ_LATEST is used'
);

View file

@ -141,8 +141,7 @@ class ChangesListBooleanFilterTest extends MediaWikiTestCase {
'priority' => 2,
] );
$this->assertEquals(
false,
$this->assertFalse(
$bar->isFeatureAvailableOnStructuredUi(),
'Only on unstructured UI'
);

View file

@ -59,10 +59,10 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
$this->assertInstanceOf( RCCacheEntry::class, $cacheEntry );
$this->assertEquals( false, $cacheEntry->watched, 'watched' );
$this->assertFalse( $cacheEntry->watched, 'watched' );
$this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
$this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
$this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertFalse( $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertUserLinks( $user->getName(), $cacheEntry );
$this->assertTitleLink( 'Xyz', $cacheEntry );
@ -94,10 +94,10 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
$this->assertInstanceOf( RCCacheEntry::class, $cacheEntry );
$this->assertEquals( false, $cacheEntry->watched, 'watched' );
$this->assertFalse( $cacheEntry->watched, 'watched' );
$this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
$this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
$this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertFalse( $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertDeleteLogLink( $cacheEntry );
$this->assertUserLinks( $user->getName(), $cacheEntry );
@ -128,10 +128,10 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
$this->assertInstanceOf( RCCacheEntry::class, $cacheEntry );
$this->assertEquals( false, $cacheEntry->watched, 'watched' );
$this->assertFalse( $cacheEntry->watched, 'watched' );
$this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
$this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
$this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertFalse( $cacheEntry->unpatrolled, 'unpatrolled' );
$this->assertRevDel( $cacheEntry );
$this->assertTitleLink( 'Zzz', $cacheEntry );

View file

@ -18,7 +18,7 @@ class ExternalStoreAccessTest extends MediaWikiTestCase {
$esFactory = new ExternalStoreFactory( $active, $defaults, 'db-prefix' );
$access = new ExternalStoreAccess( $esFactory );
$this->assertEquals( false, $access->isReadOnly() );
$this->assertFalse( $access->isReadOnly() );
/** @var ExternalStoreMemory $store */
$store = $esFactory->getStore( 'memory' );
@ -66,7 +66,7 @@ class ExternalStoreAccessTest extends MediaWikiTestCase {
$v2 = wfRandomString();
$v3 = wfRandomString();
$this->assertEquals( false, $storeLocal->fetchFromURL( 'memory://cluster1/1' ) );
$this->assertFalse( $storeLocal->fetchFromURL( 'memory://cluster1/1' ) );
$url1 = 'memory://cluster1/1';
$this->assertEquals(
@ -88,8 +88,8 @@ class ExternalStoreAccessTest extends MediaWikiTestCase {
// There is only one active store type
$this->assertEquals( $v2, $storeLocal->fetchFromURL( $url2 ) );
$this->assertEquals( $v3, $storeOther->fetchFromURL( $url3 ) );
$this->assertEquals( false, $storeOther->fetchFromURL( $url2 ) );
$this->assertEquals( false, $storeLocal->fetchFromURL( $url3 ) );
$this->assertFalse( $storeOther->fetchFromURL( $url2 ) );
$this->assertFalse( $storeLocal->fetchFromURL( $url3 ) );
$res = $access->fetchFromURLs( [ $url1, $url2, $url3 ] );
$this->assertEquals( [ $url1 => $v1, $url2 => $v2, $url3 => false ], $res, "Local-only" );

View file

@ -121,7 +121,7 @@ class ExternalStoreFactoryTest extends MediaWikiTestCase {
$v2 = wfRandomString();
$v3 = wfRandomString();
$this->assertEquals( false, $storeLocal->fetchFromURL( 'memory://cluster1/1' ) );
$this->assertFalse( $storeLocal->fetchFromURL( 'memory://cluster1/1' ) );
$url1 = 'memory://cluster1/1';
$this->assertEquals(
@ -143,8 +143,8 @@ class ExternalStoreFactoryTest extends MediaWikiTestCase {
// There is only one active store type
$this->assertEquals( $v2, $storeLocal->fetchFromURL( $url2 ) );
$this->assertEquals( $v3, $storeOther->fetchFromURL( $url3 ) );
$this->assertEquals( false, $storeOther->fetchFromURL( $url2 ) );
$this->assertEquals( false, $storeLocal->fetchFromURL( $url3 ) );
$this->assertFalse( $storeOther->fetchFromURL( $url2 ) );
$this->assertFalse( $storeLocal->fetchFromURL( $url3 ) );
$res = $access->fetchFromURLs( [ $url1, $url2, $url3 ] );
$this->assertEquals( [ $url1 => $v1, $url2 => $v2, $url3 => false ], $res, "Local-only" );

View file

@ -650,7 +650,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( [ 0 => true ], $status->success,
"Deletion of file at $source has proper 'success' field in Status ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Deletion of file at $source failed ($backendName)." );
}
@ -758,7 +758,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertHasHeaders( $op['headers'], $attr );
}
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Describe of file at $source failed ($backendName)." );
}
@ -839,7 +839,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( [ 0 => true ], $status->success,
"Creation of file at $dest has proper 'success' field in Status ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Creation of file at $dest failed ($backendName)." );
}
@ -1129,7 +1129,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true, $status->isOK(),
"Creation of concat file at $dest succeeded ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Creation of concat file at $dest failed ($backendName)." );
}
@ -1713,7 +1713,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true, $status->isOK(),
"Preparing dir $path succeeded ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Preparing dir $path failed ($backendName)." );
}
@ -1724,7 +1724,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true, $status->isOK(),
"Securing dir $path succeeded ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Securing dir $path failed ($backendName)." );
}
@ -1735,7 +1735,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true, $status->isOK(),
"Publishing dir $path succeeded ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Publishing dir $path failed ($backendName)." );
}
@ -1746,7 +1746,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true, $status->isOK(),
"Cleaning dir $path succeeded ($backendName)." );
} else {
$this->assertEquals( false, $status->isOK(),
$this->assertFalse( $status->isOK(),
"Cleaning dir $path failed ($backendName)." );
}
}
@ -1800,7 +1800,7 @@ class FileBackendTest extends MediaWikiTestCase {
"Recursive cleaning of dir $dir succeeded without warnings ($backendName)." );
foreach ( $dirs as $dir ) {
$this->assertEquals( false, $this->backend->directoryExists( [ 'dir' => $dir ] ),
$this->assertFalse( $this->backend->directoryExists( [ 'dir' => $dir ] ),
"Dir $dir no longer exists ($backendName)." );
}
}
@ -1872,11 +1872,11 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( 14, count( $status->success ),
"Operation batch has correct success array" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileA ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileA ] ),
"File does not exist at $fileA" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileB ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileB ] ),
"File does not exist at $fileB" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileD ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileD ] ),
"File does not exist at $fileD" );
$this->assertEquals( true, $this->backend->fileExists( [ 'src' => $fileC ] ),
@ -1968,11 +1968,11 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( 16, count( $status->success ),
"Operation batch has correct success array" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileA ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileA ] ),
"File does not exist at $fileA" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileB ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileB ] ),
"File does not exist at $fileB" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileD ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileD ] ),
"File does not exist at $fileD" );
$this->assertEquals( true, $this->backend->fileExists( [ 'src' => $fileC ] ),
@ -2042,9 +2042,9 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( 8, count( $status->success ),
"Operation batch has correct success array" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileB ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileB ] ),
"File does not exist at $fileB" );
$this->assertEquals( false, $this->backend->fileExists( [ 'src' => $fileD ] ),
$this->assertFalse( $this->backend->fileExists( [ 'src' => $fileD ] ),
"File does not exist at $fileD" );
$this->assertEquals( true, $this->backend->fileExists( [ 'src' => $fileA ] ),
@ -2288,7 +2288,7 @@ class FileBackendTest extends MediaWikiTestCase {
$this->assertEquals( true,
$this->backend->directoryExists( [ 'dir' => "$base/unittest-cont1/e/subdir2/subdir" ] ),
"Directory exists in ($backendName)." );
$this->assertEquals( false,
$this->assertFalse(
$this->backend->directoryExists( [ 'dir' => "$base/unittest-cont1/e/subdir2/test1.txt" ] ),
"Directory does not exists in ($backendName)." );
@ -2665,8 +2665,7 @@ class FileBackendTest extends MediaWikiTestCase {
$be->quickCreate( [
'dst' => "mwstore://localtesting/$p", 'content' => 'cattitude' ] );
$this->assertEquals(
false,
$this->assertFalse(
$be->backends[0]->getFileContents( [ 'src' => "mwstore://multitesting0/$p" ] ),
"File not yet written to backend 0"
);

View file

@ -38,8 +38,8 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( 1, $backend->get( "key$i" ) );
$cache->delete( "key$i" );
$this->assertEquals( false, $cache->get( "key$i" ) );
$this->assertEquals( false, $backend->get( "key$i" ) );
$this->assertFalse( $cache->get( "key$i" ) );
$this->assertFalse( $backend->get( "key$i" ) );
}
}
@ -75,13 +75,13 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$cache = new CachedBagOStuff( $backend );
// First hit primes the cache with miss from the backend
$this->assertEquals( false, $cache->get( 'foo' ) );
$this->assertFalse( $cache->get( 'foo' ) );
// Change the value in the backend
$backend->set( 'foo', true );
// Second hit returns the cached miss
$this->assertEquals( false, $cache->get( 'foo' ) );
$this->assertFalse( $cache->get( 'foo' ) );
// But a fresh value is read from the backend
$backend->set( 'bar', true );

View file

@ -52,7 +52,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
$cache->set( "key$i", 1 );
$this->assertEquals( 1, $cache->get( "key$i" ) );
$cache->delete( "key$i" );
$this->assertEquals( false, $cache->get( "key$i" ) );
$this->assertFalse( $cache->get( "key$i" ) );
}
}
@ -67,7 +67,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
}
$cache->clear();
for ( $i = 0; $i < 10; $i++ ) {
$this->assertEquals( false, $cache->get( "key$i" ) );
$this->assertFalse( $cache->get( "key$i" ) );
}
}
@ -88,7 +88,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( time() - 10, $cacheInternal->bag['baz'][$cache::KEY_EXP], 'Past', 2 );
$this->assertEquals( 1, $cache->get( 'bar' ), 'Key not expired' );
$this->assertEquals( false, $cache->get( 'baz' ), 'Key expired' );
$this->assertFalse( $cache->get( 'baz' ), 'Key expired' );
}
/**
@ -105,7 +105,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
for ( $i = 10; $i < 20; $i++ ) {
$cache->set( "key$i", 1 );
$this->assertEquals( 1, $cache->get( "key$i" ) );
$this->assertEquals( false, $cache->get( "key" . ( $i - 10 ) ) );
$this->assertFalse( $cache->get( "key" . ( $i - 10 ) ) );
}
}
@ -132,7 +132,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
foreach ( [ 'foo', 'baz', 'quux' ] as $key ) {
$this->assertEquals( 1, $cache->get( $key ), "Kept $key" );
}
$this->assertEquals( false, $cache->get( 'bar' ), 'Evicted bar' );
$this->assertFalse( $cache->get( 'bar' ), 'Evicted bar' );
}
/**
@ -158,6 +158,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
foreach ( [ 'foo', 'baz', 'quux' ] as $key ) {
$this->assertEquals( 1, $cache->get( $key ), "Kept $key" );
}
$this->assertEquals( false, $cache->get( 'bar' ), 'Evicted bar' );
$this->assertFalse( $cache->get( 'bar' ), 'Evicted bar' );
}
}

View file

@ -1498,7 +1498,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
$v = $cache->getWithSetCallback( $key, 30, $funcV2, $verOpts + $extOpts );
$this->assertEquals( $valueV2, $v, "Value returned" );
$this->assertEquals( 1, $wasSet, "Value regenerated" );
$this->assertEquals( false, $priorValue, "Old value not given due to old format" );
$this->assertFalse( $priorValue, "Old value not given due to old format" );
$this->assertNull( $priorAsOf, "Old value not given due to old format" );
$wasSet = 0;
@ -1765,12 +1765,12 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
$key = wfRandomString();
$opts = [ 'lag' => 0, 'since' => microtime( true ) - 300 ];
$this->cache->set( $key, $value, 30, $opts );
$this->assertEquals( false, $this->cache->get( $key ), "Trx-lagged value not written." );
$this->assertFalse( $this->cache->get( $key ), "Trx-lagged value not written." );
$key = wfRandomString();
$opts = [ 'lag' => 5, 'since' => microtime( true ) - 5 ];
$this->cache->set( $key, $value, 30, $opts );
$this->assertEquals( false, $this->cache->get( $key ), "Lagged value not written." );
$this->assertFalse( $this->cache->get( $key ), "Lagged value not written." );
}
/**
@ -1782,7 +1782,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
$key = wfRandomString();
$opts = [ 'pending' => true ];
$this->cache->set( $key, $value, 30, $opts );
$this->assertEquals( false, $this->cache->get( $key ), "Pending value not written." );
$this->assertFalse( $this->cache->get( $key ), "Pending value not written." );
}
public function testMcRouterSupport() {

View file

@ -441,12 +441,12 @@ class DatabaseMysqlBaseTest extends PHPUnit\Framework\TestCase {
if ( is_array( $rGTIDs ) ) {
$this->assertEquals( $rGTIDs, $db->getReplicaPos()->getGTIDs() );
} else {
$this->assertEquals( false, $db->getReplicaPos() );
$this->assertFalse( $db->getReplicaPos() );
}
if ( is_array( $mGTIDs ) ) {
$this->assertEquals( $mGTIDs, $db->getMasterPos()->getGTIDs() );
} else {
$this->assertEquals( false, $db->getMasterPos() );
$this->assertFalse( $db->getMasterPos() );
}
}

View file

@ -493,7 +493,7 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $db->trxLevel() );
$this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->lock( 'x', __METHOD__ ) );
$this->assertEquals( false, $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertFalse( $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->unlock( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertSame( 0, $db->trxLevel() );
@ -501,7 +501,7 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$db->setFlag( DBO_TRX );
$this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->lock( 'x', __METHOD__ ) );
$this->assertEquals( false, $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertFalse( $db->lockIsFree( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->unlock( 'x', __METHOD__ ) );
$this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
$db->clearFlag( DBO_TRX );

View file

@ -61,7 +61,7 @@ class ExtensionJsonValidationTest extends PHPUnit\Framework\TestCase {
// All good
$this->assertTrue( true );
} catch ( ExtensionJsonValidationError $e ) {
$this->assertEquals( false, $e->getMessage() );
$this->assertFalse( $e->getMessage() );
}
}
}

View file

@ -35,16 +35,16 @@ class HTMLCheckMatrixTest extends MediaWikiUnitTestCase {
return false;
},
] );
$this->assertEquals( false, $this->validate( $field, [] ) );
$this->assertFalse( $this->validate( $field, [] ) );
$this->assertTrue( $called );
}
public function testValidateRequiresArrayInput() {
$field = new HTMLCheckMatrix( self::$defaultOptions );
$this->assertEquals( false, $this->validate( $field, null ) );
$this->assertEquals( false, $this->validate( $field, true ) );
$this->assertEquals( false, $this->validate( $field, 'abc' ) );
$this->assertEquals( false, $this->validate( $field, new stdClass ) );
$this->assertFalse( $this->validate( $field, null ) );
$this->assertFalse( $this->validate( $field, true ) );
$this->assertFalse( $this->validate( $field, 'abc' ) );
$this->assertFalse( $this->validate( $field, new stdClass ) );
$this->assertEquals( true, $this->validate( $field, [] ) );
}

View file

@ -29,7 +29,7 @@ class ArticleTest extends MediaWikiUnitTestCase {
* @covers Article::__get
*/
public function testImplementsGetMagic() {
$this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
$this->assertFalse( $this->article->mLatest, "Article __get magic" );
}
/**

View file

@ -62,7 +62,7 @@ class ForeignTitleTest extends \MediaWikiUnitTestCase {
public function testUnknownNamespaceCheck() {
$title = new ForeignTitle( null, 'this', 'that' );
$this->assertEquals( false, $title->isNamespaceIdKnown() );
$this->assertFalse( $title->isNamespaceIdKnown() );
$this->assertEquals( 'this', $title->getNamespaceName() );
$this->assertEquals( 'that', $title->getText() );
}