Simplify/remove duplicate assertStatusOK and such
For example: * assertStatusGood = ok without any errors or warnings * assertStatusWarning = ok, but not good, i.e. there is a warning Change-Id: I4b3ec7a3c5b028c0505e1371c297a9c47e448b42
This commit is contained in:
parent
5df8b7758d
commit
3790383134
9 changed files with 39 additions and 90 deletions
|
|
@ -192,7 +192,7 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertNull( $updater->getNewRevision(), 'getNewRevision()' );
|
||||
$this->assertFalse( $updater->wasRevisionCreated(), 'wasRevisionCreated' );
|
||||
$this->assertTrue( $updater->wasSuccessful(), 'wasSuccessful()' );
|
||||
$this->assertStatusWarning( 'edit-no-change', $status, 'edit-no-change' );
|
||||
$this->assertStatusWarning( 'edit-no-change', $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -339,8 +339,7 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertNotSame( $parentId, $rev->getId(), 'new revision ID' );
|
||||
$this->assertTrue( $updater->wasRevisionCreated(), 'wasRevisionCreated' );
|
||||
$this->assertTrue( $updater->wasSuccessful(), 'wasSuccessful()' );
|
||||
$this->assertStatusOK( $status, 'getStatus()->isOK()' );
|
||||
$this->assertFalse( $status->hasMessage( 'edit-no-change' ), 'edit-no-change' );
|
||||
$this->assertStatusGood( $status );
|
||||
// Setting setForceEmptyRevision causes the original revision to be set.
|
||||
$this->assertEquals( $parentId, $updater->getEditResult()->getOriginalRevisionId() );
|
||||
}
|
||||
|
|
@ -544,9 +543,8 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
|
|||
"MultiContentSave returned false, but revision was still created." );
|
||||
|
||||
$status = $updater->getStatus();
|
||||
$this->assertStatusNotOK( $status,
|
||||
$this->assertStatusError( $expectedError, $status,
|
||||
"MultiContentSave returned false, but Status is not fatal." );
|
||||
$this->assertSame( $expectedError, $status->getMessage()->getKey() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -780,7 +778,7 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
|
|||
$updater->updateRevision();
|
||||
|
||||
$status = $updater->getStatus();
|
||||
$this->assertStatusOK( $status );
|
||||
$this->assertStatusGood( $status );
|
||||
$rev = $status->getNewRevision();
|
||||
$slot = $rev->getSlot( 'derivedslot' );
|
||||
$this->assertTrue( $slot->getContent()->equals( $content ) );
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ class JsonContentHandlerIntegrationTest extends MediaWikiLangTestCase {
|
|||
$invalidJson = new JsonContent( '{"key":' );
|
||||
|
||||
$this->assertStatusGood( $handler->validateSave( $validJson, $validationParams ) );
|
||||
$this->assertStatusNotOK( $handler->validateSave( $invalidJson, $validationParams ) );
|
||||
$this->assertStatusError( 'invalid-json-data',
|
||||
$handler->validateSave( $invalidJson, $validationParams ) );
|
||||
|
||||
$this->setTemporaryHook(
|
||||
'JsonValidateSave',
|
||||
|
|
@ -105,7 +106,6 @@ class JsonContentHandlerIntegrationTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
);
|
||||
|
||||
$this->assertStatusNotOK( $handler->validateSave( $validJson, $validationParams ) );
|
||||
$this->assertStatusError( 'invalid-json-data',
|
||||
$handler->validateSave( $invalidJson, $validationParams ) );
|
||||
$this->assertStatusError( 'missing-key-foo',
|
||||
|
|
|
|||
|
|
@ -163,8 +163,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$this->assertStatusGood( $status,
|
||||
"Store from $source to $dest succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Store from $source to $dest succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Store from $source to $dest has proper 'success' field in Status ($backendName)." );
|
||||
$this->assertTrue( is_file( $source ),
|
||||
|
|
@ -241,8 +239,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertStatusGood(
|
||||
$status,
|
||||
"Copy from $source to $dest succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Copy from $source to $dest succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Copy from $source to $dest has proper 'success' field in Status ($backendName)." );
|
||||
if ( !is_string( $srcContent ) ) {
|
||||
|
|
@ -267,7 +263,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
"Source and destination have the same props ($backendName)." );
|
||||
}
|
||||
} else {
|
||||
$this->assertStatusNotGood(
|
||||
$this->assertStatusNotOK(
|
||||
$status,
|
||||
"Copy from $source to $dest fails ($backendName)." );
|
||||
$this->assertSame(
|
||||
|
|
@ -392,8 +388,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertStatusGood(
|
||||
$status,
|
||||
"Move from $source to $dest succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Move from $source to $dest succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Move from $source to $dest has proper 'success' field in Status ($backendName)." );
|
||||
if ( !is_string( $srcContent ) ) {
|
||||
|
|
@ -416,7 +410,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
"Source and destination have the same props ($backendName)." );
|
||||
}
|
||||
} else {
|
||||
$this->assertStatusNotGood(
|
||||
$this->assertStatusNotOK(
|
||||
$status,
|
||||
"Move from $source to $dest fails ($backendName)." );
|
||||
$this->assertSame(
|
||||
|
|
@ -533,8 +527,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $okStatus ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Deletion of file at $source succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Deletion of file at $source succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Deletion of file at $source has proper 'success' field in Status ($backendName)." );
|
||||
} else {
|
||||
|
|
@ -637,8 +629,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $okStatus ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Describe of file at $source succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Describe of file at $source succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Describe of file at $source has proper 'success' field in Status ($backendName)." );
|
||||
if ( $this->backend->hasFeatures( FileBackend::ATTR_HEADERS ) ) {
|
||||
|
|
@ -722,8 +712,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $okStatus ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Creation of file at $dest succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Creation of file at $dest succeeded ($backendName)." );
|
||||
$this->assertEquals( [ 0 => true ], $status->success,
|
||||
"Creation of file at $dest has proper 'success' field in Status ($backendName)." );
|
||||
} else {
|
||||
|
|
@ -1014,8 +1002,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $okStatus ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Creation of concat file at $dest succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Creation of concat file at $dest succeeded ($backendName)." );
|
||||
} else {
|
||||
$this->assertStatusNotOK( $status,
|
||||
"Creation of concat file at $dest failed ($backendName)." );
|
||||
|
|
@ -1598,8 +1584,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $isOK ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Preparing dir $path succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Preparing dir $path succeeded ($backendName)." );
|
||||
} else {
|
||||
$this->assertStatusNotOK( $status,
|
||||
"Preparing dir $path failed ($backendName)." );
|
||||
|
|
@ -1609,8 +1593,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $isOK ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Securing dir $path succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Securing dir $path succeeded ($backendName)." );
|
||||
} else {
|
||||
$this->assertStatusNotOK( $status,
|
||||
"Securing dir $path failed ($backendName)." );
|
||||
|
|
@ -1620,8 +1602,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $isOK ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Publishing dir $path succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Publishing dir $path succeeded ($backendName)." );
|
||||
} else {
|
||||
$this->assertStatusNotOK( $status,
|
||||
"Publishing dir $path failed ($backendName)." );
|
||||
|
|
@ -1631,8 +1611,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $isOK ) {
|
||||
$this->assertStatusGood( $status,
|
||||
"Cleaning dir $path succeeded without warnings ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Cleaning dir $path succeeded ($backendName)." );
|
||||
} else {
|
||||
$this->assertStatusNotOK( $status,
|
||||
"Cleaning dir $path failed ($backendName)." );
|
||||
|
|
@ -1756,7 +1734,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
] );
|
||||
|
||||
$this->assertStatusGood( $status, "Operation batch succeeded" );
|
||||
$this->assertStatusOK( $status, "Operation batch succeeded" );
|
||||
$this->assertCount( 14, $status->success,
|
||||
"Operation batch has correct success array" );
|
||||
|
||||
|
|
@ -1852,7 +1829,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
] );
|
||||
|
||||
$this->assertStatusGood( $status, "Operation batch succeeded" );
|
||||
$this->assertStatusOK( $status, "Operation batch succeeded" );
|
||||
$this->assertCount( 16, $status->success,
|
||||
"Operation batch has correct success array" );
|
||||
|
||||
|
|
@ -1925,8 +1901,8 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
// Does nothing
|
||||
], [ 'force' => 1 ] );
|
||||
|
||||
$this->assertStatusNotGood( $status, "Operation had warnings" );
|
||||
$this->assertStatusOK( $status, "Operation batch succeeded" );
|
||||
$this->assertStatusWarning( 'backend-fail-alreadyexists', $status );
|
||||
$this->assertStatusWarning( 'backend-fail-notsame', $status );
|
||||
$this->assertCount( 8, $status->success,
|
||||
"Operation batch has correct success array" );
|
||||
|
||||
|
|
@ -1996,8 +1972,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$status = $this->backend->doQuickOperations( $ops );
|
||||
$this->assertStatusGood( $status,
|
||||
"Creation of files succeeded ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Creation of files succeeded with OK status ($backendName)." );
|
||||
|
||||
// Expected listing at root
|
||||
$expected = [
|
||||
|
|
@ -2178,8 +2152,6 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$status = $this->backend->doQuickOperations( $ops );
|
||||
$this->assertStatusGood( $status,
|
||||
"Creation of files succeeded ($backendName)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Creation of files succeeded with OK status ($backendName)." );
|
||||
|
||||
$this->assertTrue(
|
||||
$this->backend->directoryExists( [ 'dir' => "$base/unittest-cont1/e/subdir1" ] ),
|
||||
|
|
@ -2398,52 +2370,36 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
$status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->lockFiles( $paths, LockManager::LOCK_SH );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->unlockFiles( $paths, LockManager::LOCK_SH );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->unlockFiles( $paths, LockManager::LOCK_EX );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName). ($i)" );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
# # Flip the acquire/release ordering around ##
|
||||
|
||||
$status = $this->backend->lockFiles( $paths, LockManager::LOCK_SH );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->lockFiles( $paths, LockManager::LOCK_EX );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->unlockFiles( $paths, LockManager::LOCK_EX );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName). ($i)" );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
|
||||
$status = $this->backend->unlockFiles( $paths, LockManager::LOCK_SH );
|
||||
$this->assertStatusGood( $status,
|
||||
"Locking of files succeeded ($backendName) ($i)." );
|
||||
$this->assertStatusOK( $status,
|
||||
"Locking of files succeeded with OK status ($backendName) ($i)." );
|
||||
}
|
||||
|
||||
$status = Status::newGood();
|
||||
|
|
@ -2667,7 +2623,7 @@ class FileBackendIntegrationTest extends MediaWikiIntegrationTestCase {
|
|||
if ( $okSyncStatus ) {
|
||||
$this->assertStatusGood( $status, "Files synced: " . implode( ',', $paths ) );
|
||||
} else {
|
||||
$this->assertStatusNotGood( $status, "Files not synced: " . implode( ',', $paths ) );
|
||||
$this->assertStatusNotOK( $status, "Files not synced: " . implode( ',', $paths ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class StoreBatchTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
private function storecohort( $fn, $infn, $otherfn, $fromrepo ) {
|
||||
$f = $this->storeit( $fn, $infn, 0 );
|
||||
$this->assertStatusOK( $f, 'failed to store a new file' );
|
||||
$this->assertStatusGood( $f, 'failed to store a new file' );
|
||||
$this->assertSame( 0, $f->failCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
$this->assertSame( 1, $f->successCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
if ( $fromrepo ) {
|
||||
|
|
@ -99,17 +99,17 @@ class StoreBatchTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
// This should work because we're allowed to overwrite
|
||||
$f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE );
|
||||
$this->assertStatusOK( $f, 'We should be allowed to overwrite' );
|
||||
$this->assertStatusGood( $f, 'We should be allowed to overwrite' );
|
||||
$this->assertSame( 0, $f->failCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
$this->assertSame( 1, $f->successCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
// This should fail because we're overwriting.
|
||||
$f = $this->storeit( $fn, $infn, 0 );
|
||||
$this->assertStatusNotOK( $f, 'We should not be allowed to overwrite' );
|
||||
$this->assertStatusError( 'backend-fail-alreadyexists', $f, 'We should not be allowed to overwrite' );
|
||||
$this->assertSame( 1, $f->failCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
$this->assertSame( 0, $f->successCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
// This should succeed because we're overwriting the same content.
|
||||
$f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE_SAME );
|
||||
$this->assertStatusOK( $f, 'We should be able to overwrite the same content' );
|
||||
$this->assertStatusGood( $f, 'We should be able to overwrite the same content' );
|
||||
$this->assertSame( 0, $f->failCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
$this->assertSame( 1, $f->successCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
// This should fail because we're overwriting different content.
|
||||
|
|
@ -118,7 +118,7 @@ class StoreBatchTest extends MediaWikiIntegrationTestCase {
|
|||
$otherfn = $f->value;
|
||||
}
|
||||
$f = $this->storeit( $fn, $otherfn, FileRepo::OVERWRITE_SAME );
|
||||
$this->assertStatusNotOK( $f, 'We should not be allowed to overwrite different content' );
|
||||
$this->assertStatusError( 'backend-fail-notsame', $f, 'We should not be allowed to overwrite different content' );
|
||||
$this->assertSame( 1, $f->failCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
$this->assertSame( 0, $f->successCount, "counts wrong {$f->successCount} {$f->failCount}" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOptions = $this->getParserOptions();
|
||||
$status = $access->getParserOutput( $page, $parserOptions );
|
||||
$this->assertStatusNotOK( $status );
|
||||
$this->assertStatusError( 'missing-revision', $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -491,7 +491,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
// output is for the first revision denied
|
||||
$parserOptions = $this->getParserOptions();
|
||||
$status = $access->getParserOutput( $page, $parserOptions, $firstRev );
|
||||
$this->assertStatusNotOK( $status );
|
||||
$this->assertStatusError( 'missing-revision-permission', $status );
|
||||
// TODO: Once PoolWorkArticleView properly reports errors, check that the correct error
|
||||
// is propagated.
|
||||
}
|
||||
|
|
@ -682,7 +682,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOptions = $this->getParserOptions();
|
||||
$status = $access->getParserOutput( $page, $parserOptions );
|
||||
$this->assertStatusNotOK( $status );
|
||||
$this->assertStatusError( 'nopagetext', $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -771,7 +771,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOptions = $this->getParserOptions();
|
||||
$result = $access->getParserOutput( $page, $parserOptions );
|
||||
$this->assertStatusNotOK( $result );
|
||||
$this->assertStatusError( 'pool-timeout', $result );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
|
||||
$status = $page->doUserEditContent( $content, $user1, "[[testing]] 1", EDIT_NEW );
|
||||
|
||||
$this->assertStatusOK( $status, 'OK' );
|
||||
$this->assertStatusGood( $status );
|
||||
$this->assertTrue( $status->value['new'], 'new' );
|
||||
$this->assertNotNull( $status->getNewRevision(), 'revision-record' );
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
|
||||
// try null edit, with a different user
|
||||
$status = $page->doUserEditContent( $content, $user2, 'This changes nothing', EDIT_UPDATE, false );
|
||||
$this->assertStatusOK( $status, 'OK' );
|
||||
$this->assertStatusWarning( 'edit-no-change', $status );
|
||||
$this->assertFalse( $status->value['new'], 'new' );
|
||||
$this->assertNull( $status->getNewRevision(), 'revision-record' );
|
||||
$this->assertNotNull( $page->getRevisionRecord() );
|
||||
|
|
@ -363,7 +363,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
);
|
||||
|
||||
$status = $page->doUserEditContent( $content, $user1, "testing 2", EDIT_UPDATE );
|
||||
$this->assertStatusOK( $status, 'OK' );
|
||||
$this->assertStatusGood( $status );
|
||||
$this->assertFalse( $status->value['new'], 'new' );
|
||||
$this->assertNotNull( $status->getNewRevision(), 'revision-record' );
|
||||
$statusRevRecord = $status->getNewRevision();
|
||||
|
|
@ -456,8 +456,8 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
$status1 = $page->doUserEditContent( $content, $user, __METHOD__ );
|
||||
$status2 = $page->doUserEditContent( $content, $user, __METHOD__ );
|
||||
|
||||
$this->assertStatusOK( $status1, 'OK' );
|
||||
$this->assertStatusOK( $status2, 'OK' );
|
||||
$this->assertStatusGood( $status1 );
|
||||
$this->assertStatusWarning( 'edit-no-change', $status2 );
|
||||
|
||||
$this->assertNotNull( $status1->getNewRevision(), 'OK' );
|
||||
$this->assertNull( $status2->getNewRevision(), 'OK' );
|
||||
|
|
@ -1713,8 +1713,7 @@ more stuff
|
|||
$this->setService( 'ReadOnlyMode', $readOnly );
|
||||
|
||||
$status = $page->doUpdateRestrictions( [], [], $cascade, 'aReason', $user, [] );
|
||||
$this->assertStatusNotOK( $status );
|
||||
$this->assertSame( 'readonlytext', $status->getMessage()->getKey() );
|
||||
$this->assertStatusError( 'readonlytext', $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -196,8 +196,7 @@ class UserPasswordPolicyTest extends MediaWikiIntegrationTestCase {
|
|||
$user->addToDatabase();
|
||||
|
||||
$status = $upp->checkUserPassword( $user, 'Passpass' );
|
||||
$this->assertStatusNotGood( $status, 'password invalid' );
|
||||
$this->assertStatusOK( $status, 'can login' );
|
||||
$this->assertStatusWarning( 'password-login-forbidden', $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test block'
|
||||
)->placeBlock();
|
||||
$this->assertStatusOK( $status );
|
||||
$this->assertStatusGood( $status );
|
||||
$block = $this->user->getBlock();
|
||||
$this->assertSame( 'test block', $block->getReasonComment()->text );
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $block );
|
||||
|
|
@ -64,7 +64,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'isHideUser' => true
|
||||
]
|
||||
)->placeBlock();
|
||||
$this->assertStatusOK( $status );
|
||||
$this->assertStatusGood( $status );
|
||||
$block = $this->user->getBlock();
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $block );
|
||||
$this->assertSame( 'test hideuser', $block->getReasonComment()->text );
|
||||
|
|
@ -118,7 +118,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
[],
|
||||
[ $page ]
|
||||
)->placeBlock();
|
||||
$this->assertStatusOK( $status );
|
||||
$this->assertStatusGood( $status );
|
||||
$block = $this->user->getBlock();
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $block );
|
||||
$this->assertSame( 'test existingpage', $block->getReasonComment()->text );
|
||||
|
|
@ -151,7 +151,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test block'
|
||||
)->placeBlockUnsafe();
|
||||
$this->assertStatusOK( $blockStatus );
|
||||
$this->assertStatusGood( $blockStatus );
|
||||
$priorBlock = $this->user->getBlock();
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $priorBlock );
|
||||
$this->assertSame( 'test block', $priorBlock->getReasonComment()->text );
|
||||
|
|
@ -164,7 +164,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test reblock'
|
||||
)->placeBlockUnsafe( /*reblock=*/false );
|
||||
$this->assertStatusNotOK( $reblockStatus );
|
||||
$this->assertStatusError( 'ipb_already_blocked', $reblockStatus );
|
||||
|
||||
$this->user->clearInstanceCache();
|
||||
$block = $this->user->getBlock();
|
||||
|
|
@ -177,7 +177,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test block'
|
||||
)->placeBlockUnsafe( /*reblock=*/true );
|
||||
$this->assertStatusNotOK( $reblockStatus );
|
||||
$this->assertStatusError( 'ipb_already_blocked', $reblockStatus );
|
||||
|
||||
$this->user->clearInstanceCache();
|
||||
$block = $this->user->getBlock();
|
||||
|
|
@ -190,7 +190,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test reblock'
|
||||
)->placeBlockUnsafe( /*reblock=*/true );
|
||||
$this->assertStatusOK( $reblockStatus );
|
||||
$this->assertStatusGood( $reblockStatus );
|
||||
|
||||
$this->user->clearInstanceCache();
|
||||
$block = $this->user->getBlock();
|
||||
|
|
@ -220,7 +220,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test block'
|
||||
)->placeBlockUnsafe();
|
||||
$this->assertStatusOK( $blockStatus );
|
||||
$this->assertStatusGood( $blockStatus );
|
||||
$priorBlock = $this->user->getBlock();
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $priorBlock );
|
||||
$this->assertSame( $priorBlock->getId(), $hookBlock->getId() );
|
||||
|
|
@ -234,7 +234,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test reblock'
|
||||
)->placeBlockUnsafe( /*reblock=*/true );
|
||||
$this->assertStatusOK( $reblockStatus );
|
||||
$this->assertStatusGood( $reblockStatus );
|
||||
|
||||
$this->user->clearInstanceCache();
|
||||
$newBlock = $this->user->getBlock();
|
||||
|
|
@ -254,7 +254,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'test block with autoblocking',
|
||||
[ 'isAutoblocking' => true ]
|
||||
)->placeBlockUnsafe();
|
||||
$this->assertStatusOK( $blockStatus );
|
||||
$this->assertStatusGood( $blockStatus );
|
||||
$block = $blockStatus->getValue();
|
||||
|
||||
$target = '1.2.3.4';
|
||||
|
|
@ -277,7 +277,7 @@ class BlockUserTest extends MediaWikiIntegrationTestCase {
|
|||
'infinity',
|
||||
'test IP block'
|
||||
)->placeBlockUnsafe();
|
||||
$this->assertStatusOK( $IPBlockStatus );
|
||||
$this->assertStatusGood( $IPBlockStatus );
|
||||
$IPBlock = $IPBlockStatus->getValue();
|
||||
$this->assertInstanceOf( DatabaseBlock::class, $IPBlock );
|
||||
$this->assertNull( $hookPriorBlock );
|
||||
|
|
|
|||
|
|
@ -778,10 +778,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
|
||||
$status = $watchlistManager->removeWatch( $authority, $title );
|
||||
|
||||
$this->assertStatusNotGood( $status );
|
||||
$errors = $status->getErrors();
|
||||
$this->assertCount( 1, $errors );
|
||||
$this->assertEquals( 'hookaborted', $errors[0]['message'] );
|
||||
$this->assertStatusError( 'hookaborted', $status );
|
||||
$this->assertTrue( $watchlistManager->isWatchedIgnoringRights( $userIdentity, $title ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue