MediaWiki  master
RevisionTest Class Reference

Test cases in RevisionTest should not interact with the Database. More...

Inheritance diagram for RevisionTest:
Collaboration diagram for RevisionTest:

Public Member Functions

 getMockTitle ( $model=CONTENT_MODEL_WIKITEXT)
 
 provideConstructFromArray ()
 
 provideConstructFromArray_userSetAsExpected ()
 
 provideConstructFromArrayThrowsExceptions ()
 
 provideConstructFromRow ()
 
 provideDecompressRevisionText ()
 
 provideGetId ()
 
 provideGetParentId ()
 
 provideGetRevisionText ()
 
 provideGetRevisionTextWithGzipAndLegacyEncoding ()
 
 provideGetRevisionTextWithLegacyEncoding ()
 
 provideGetRevisionTextWithZlibExtension ()
 
 provideGetRevisionTextWithZlibExtension_badData ()
 
 provideSetId ()
 
 provideSetUserIdAndName ()
 
 provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts ()
 
 provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal ()
 
 setUp ()
 
 testCompressRevisionTextUtf8 ()
 Revision::compressRevisionText. More...
 
 testCompressRevisionTextUtf8Gzip ()
 Revision::compressRevisionText. More...
 
 testConstructFromArray ( $rowArray)
 provideConstructFromArray Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray More...
 
 testConstructFromArray_userSetAsExpected (array $rowArray, $expectedUserId, $expectedUserName)
 provideConstructFromArray_userSetAsExpected Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray More...
 
 testConstructFromArrayThrowsExceptions ( $rowArray, Exception $expectedException)
 provideConstructFromArrayThrowsExceptions Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray More...
 
 testConstructFromArrayWithBadPageId ()
 Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray. More...
 
 testConstructFromEmptyArray ()
 Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray. More...
 
 testConstructFromNothing ()
 Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray. More...
 
 testConstructFromRow (array $arrayData, callable $assertions)
 provideConstructFromRow Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray More...
 
 testConstructFromRowWithBadPageId ()
 Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray. More...
 
 testDecompressRevisionText ( $legacyEncoding, $text, $flags, $expected)
 provideDecompressRevisionText Revision::decompressRevisionText More...
 
 testGetContent ()
 Revision::getContent. More...
 
 testGetContent_failure ()
 Revision::getContent. More...
 
 testGetId ( $rowArray, $expectedId)
 provideGetId Revision::getId More...
 
 testGetParentId ( $rowArray, $expected)
 provideGetParentId Revision::getParentId() More...
 
 testGetRevisionText ( $expected, $rowData, $prefix='old_', $wiki=false)
 Revision::getRevisionText provideGetRevisionText. More...
 
 testGetRevisionText_external_noOldId ()
 Revision::getRevisionText. More...
 
 testGetRevisionText_external_oldId ()
 Revision::getRevisionText. More...
 
 testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts ( $text)
 provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts Revision::getRevisionText More...
 
 testGetRevisionText_returnsDecompressedTextFieldWhenNotExternal ( $row, $prefix, $expected)
 provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal Revision::getRevisionText More...
 
 testGetRevisionWithGzipAndLegacyEncoding ( $expected, $lang, $encoding, $rowData)
 Revision::getRevisionText provideGetRevisionTextWithGzipAndLegacyEncoding. More...
 
 testGetRevisionWithLegacyEncoding ( $expected, $lang, $encoding, $rowData)
 Revision::getRevisionText provideGetRevisionTextWithLegacyEncoding. More...
 
 testGetRevisionWithZlibExtension ( $expected, $rowData)
 Revision::getRevisionText provideGetRevisionTextWithZlibExtension. More...
 
 testGetRevisionWithZlibExtension_badData ( $expected, $rowData)
 Revision::getRevisionText provideGetRevisionTextWithZlibExtension_badData. More...
 
 testGetSha1 ()
 Revision::getSha1. More...
 
 testGetSha1_failure ()
 Revision::getSha1. More...
 
 testGetSize ()
 Revision::getSize. More...
 
 testGetSize_failure ()
 Revision::getSize. More...
 
 testLoadFromTitle ()
 Revision::loadFromTitle. More...
 
 testSetId ( $input, $expected)
 provideSetId Revision::setId More...
 
 testSetUserIdAndName ( $inputId, $expectedId, $name)
 provideSetUserIdAndName Revision::setUserIdAndName More...
 

Private Member Functions

 getBlobStore ()
 
 getRevisionStore ()
 
 getWANObjectCache ()
 
 mockBlobStoreFactory ( $blobStore)
 

Detailed Description

Test cases in RevisionTest should not interact with the Database.

For test cases that need Database interaction see RevisionDbTestBase.

Definition at line 18 of file RevisionTest.php.

Member Function Documentation

◆ getBlobStore()

RevisionTest::getBlobStore ( )
private

◆ getMockTitle()

◆ getRevisionStore()

RevisionTest::getRevisionStore ( )
private
Returns
RevisionStore

Definition at line 466 of file RevisionTest.php.

References $cache, class, getBlobStore(), getWANObjectCache(), and MIGRATION_OLD.

◆ getWANObjectCache()

RevisionTest::getWANObjectCache ( )
private

◆ mockBlobStoreFactory()

◆ provideConstructFromArray()

RevisionTest::provideConstructFromArray ( )

Definition at line 28 of file RevisionTest.php.

References CONTENT_MODEL_JAVASCRIPT.

◆ provideConstructFromArray_userSetAsExpected()

RevisionTest::provideConstructFromArray_userSetAsExpected ( )

Definition at line 103 of file RevisionTest.php.

References null.

◆ provideConstructFromArrayThrowsExceptions()

RevisionTest::provideConstructFromArrayThrowsExceptions ( )

Definition at line 159 of file RevisionTest.php.

◆ provideConstructFromRow()

RevisionTest::provideConstructFromRow ( )

Definition at line 209 of file RevisionTest.php.

References $rev, Revision\DELETED_TEXT, and null.

◆ provideDecompressRevisionText()

RevisionTest::provideDecompressRevisionText ( )

Definition at line 670 of file RevisionTest.php.

References false, and serialize().

◆ provideGetId()

RevisionTest::provideGetId ( )

Definition at line 295 of file RevisionTest.php.

References null.

◆ provideGetParentId()

RevisionTest::provideGetParentId ( )

Definition at line 346 of file RevisionTest.php.

References null.

◆ provideGetRevisionText()

RevisionTest::provideGetRevisionText ( )

Definition at line 361 of file RevisionTest.php.

References object.

◆ provideGetRevisionTextWithGzipAndLegacyEncoding()

RevisionTest::provideGetRevisionTextWithGzipAndLegacyEncoding ( )

Definition at line 521 of file RevisionTest.php.

References object.

◆ provideGetRevisionTextWithLegacyEncoding()

RevisionTest::provideGetRevisionTextWithLegacyEncoding ( )

Definition at line 488 of file RevisionTest.php.

References object.

◆ provideGetRevisionTextWithZlibExtension()

RevisionTest::provideGetRevisionTextWithZlibExtension ( )

Definition at line 385 of file RevisionTest.php.

References object.

◆ provideGetRevisionTextWithZlibExtension_badData()

RevisionTest::provideGetRevisionTextWithZlibExtension_badData ( )

Definition at line 404 of file RevisionTest.php.

References object.

◆ provideSetId()

RevisionTest::provideSetId ( )

Definition at line 315 of file RevisionTest.php.

◆ provideSetUserIdAndName()

RevisionTest::provideSetUserIdAndName ( )

Definition at line 330 of file RevisionTest.php.

◆ provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts()

RevisionTest::provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts ( )

Definition at line 781 of file RevisionTest.php.

◆ provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal()

RevisionTest::provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal ( )

Definition at line 744 of file RevisionTest.php.

References object.

◆ setUp()

RevisionTest::setUp ( )

Definition at line 20 of file RevisionTest.php.

References SCHEMA_COMPAT_READ_NEW, and SCHEMA_COMPAT_WRITE_BOTH.

◆ testCompressRevisionTextUtf8()

RevisionTest::testCompressRevisionTextUtf8 ( )

◆ testCompressRevisionTextUtf8Gzip()

RevisionTest::testCompressRevisionTextUtf8Gzip ( )

◆ testConstructFromArray()

RevisionTest::testConstructFromArray (   $rowArray)

provideConstructFromArray Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray

Definition at line 76 of file RevisionTest.php.

References $rev, CONTENT_MODEL_JAVASCRIPT, and getMockTitle().

◆ testConstructFromArray_userSetAsExpected()

RevisionTest::testConstructFromArray_userSetAsExpected ( array  $rowArray,
  $expectedUserId,
  $expectedUserName 
)

provideConstructFromArray_userSetAsExpected Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray

Parameters
array$rowArray
mixed$expectedUserIdnull to expect the current wgUser ID
mixed$expectedUserNamenull to expect the current wgUser name

Definition at line 140 of file RevisionTest.php.

References $rev, getMockTitle(), and null.

◆ testConstructFromArrayThrowsExceptions()

RevisionTest::testConstructFromArrayThrowsExceptions (   $rowArray,
Exception  $expectedException 
)

provideConstructFromArrayThrowsExceptions Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray

Definition at line 189 of file RevisionTest.php.

References getMockTitle().

◆ testConstructFromArrayWithBadPageId()

RevisionTest::testConstructFromArrayWithBadPageId ( )

Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray.

Definition at line 96 of file RevisionTest.php.

References $rev.

◆ testConstructFromEmptyArray()

RevisionTest::testConstructFromEmptyArray ( )

Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray.

Definition at line 87 of file RevisionTest.php.

References $rev, and getMockTitle().

◆ testConstructFromNothing()

RevisionTest::testConstructFromNothing ( )

Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray.

Definition at line 202 of file RevisionTest.php.

References class.

◆ testConstructFromRow()

RevisionTest::testConstructFromRow ( array  $arrayData,
callable  $assertions 
)

provideConstructFromRow Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray

Definition at line 273 of file RevisionTest.php.

References $rev, getMockTitle(), and object.

◆ testConstructFromRowWithBadPageId()

RevisionTest::testConstructFromRowWithBadPageId ( )

Revision::__construct \MediaWiki\Revision\RevisionStore::newMutableRevisionFromArray.

Definition at line 283 of file RevisionTest.php.

References $rev, and null.

◆ testDecompressRevisionText()

RevisionTest::testDecompressRevisionText (   $legacyEncoding,
  $text,
  $flags,
  $expected 
)

provideDecompressRevisionText Revision::decompressRevisionText

Parameters
bool$legacyEncoding
mixed$text
array$flags
mixed$expected

Definition at line 731 of file RevisionTest.php.

References Revision\decompressRevisionText(), Language\factory(), getBlobStore(), and mockBlobStoreFactory().

◆ testGetContent()

RevisionTest::testGetContent ( )

Revision::getContent.

Definition at line 932 of file RevisionTest.php.

References $content, $rev, $title, and getMockTitle().

◆ testGetContent_failure()

RevisionTest::testGetContent_failure ( )

Revision::getContent.

Definition at line 948 of file RevisionTest.php.

References $rev, $title, class, and getMockTitle().

◆ testGetId()

RevisionTest::testGetId (   $rowArray,
  $expectedId 
)

provideGetId Revision::getId

Definition at line 310 of file RevisionTest.php.

References $rev, and getMockTitle().

◆ testGetParentId()

RevisionTest::testGetParentId (   $rowArray,
  $expected 
)

provideGetParentId Revision::getParentId()

Definition at line 356 of file RevisionTest.php.

References $rev, and getMockTitle().

◆ testGetRevisionText()

RevisionTest::testGetRevisionText (   $expected,
  $rowData,
  $prefix = 'old_',
  $wiki = false 
)

◆ testGetRevisionText_external_noOldId()

RevisionTest::testGetRevisionText_external_noOldId ( )

◆ testGetRevisionText_external_oldId()

RevisionTest::testGetRevisionText_external_oldId ( )

◆ testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts()

RevisionTest::testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts (   $text)

provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts Revision::getRevisionText

Definition at line 790 of file RevisionTest.php.

References Revision\getRevisionText().

◆ testGetRevisionText_returnsDecompressedTextFieldWhenNotExternal()

RevisionTest::testGetRevisionText_returnsDecompressedTextFieldWhenNotExternal (   $row,
  $prefix,
  $expected 
)

provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal Revision::getRevisionText

Definition at line 773 of file RevisionTest.php.

References Revision\getRevisionText().

◆ testGetRevisionWithGzipAndLegacyEncoding()

RevisionTest::testGetRevisionWithGzipAndLegacyEncoding (   $expected,
  $lang,
  $encoding,
  $rowData 
)

Revision::getRevisionText provideGetRevisionTextWithGzipAndLegacyEncoding.

Definition at line 551 of file RevisionTest.php.

References $lang, Language\factory(), getBlobStore(), mockBlobStoreFactory(), and testGetRevisionText().

◆ testGetRevisionWithLegacyEncoding()

RevisionTest::testGetRevisionWithLegacyEncoding (   $expected,
  $lang,
  $encoding,
  $rowData 
)

Revision::getRevisionText provideGetRevisionTextWithLegacyEncoding.

Definition at line 513 of file RevisionTest.php.

References $lang, Language\factory(), getBlobStore(), mockBlobStoreFactory(), and testGetRevisionText().

◆ testGetRevisionWithZlibExtension()

RevisionTest::testGetRevisionWithZlibExtension (   $expected,
  $rowData 
)

Revision::getRevisionText provideGetRevisionTextWithZlibExtension.

Definition at line 399 of file RevisionTest.php.

References testGetRevisionText().

◆ testGetRevisionWithZlibExtension_badData()

RevisionTest::testGetRevisionWithZlibExtension_badData (   $expected,
  $rowData 
)

Revision::getRevisionText provideGetRevisionTextWithZlibExtension_badData.

Definition at line 418 of file RevisionTest.php.

References Revision\getRevisionText().

◆ testGetSha1()

RevisionTest::testGetSha1 ( )

Revision::getSha1.

Definition at line 899 of file RevisionTest.php.

References $rev, $title, and getMockTitle().

◆ testGetSha1_failure()

RevisionTest::testGetSha1_failure ( )

Revision::getSha1.

Definition at line 915 of file RevisionTest.php.

References $rev, $title, class, and getMockTitle().

◆ testGetSize()

RevisionTest::testGetSize ( )

Revision::getSize.

Definition at line 867 of file RevisionTest.php.

References $rev, $title, and getMockTitle().

◆ testGetSize_failure()

RevisionTest::testGetSize_failure ( )

Revision::getSize.

Definition at line 882 of file RevisionTest.php.

References $rev, $title, class, and getMockTitle().

◆ testLoadFromTitle()

RevisionTest::testLoadFromTitle ( )

◆ testSetId()

RevisionTest::testSetId (   $input,
  $expected 
)

provideSetId Revision::setId

Definition at line 324 of file RevisionTest.php.

References $input, $rev, and getMockTitle().

◆ testSetUserIdAndName()

RevisionTest::testSetUserIdAndName (   $inputId,
  $expectedId,
  $name 
)

provideSetUserIdAndName Revision::setUserIdAndName

Definition at line 339 of file RevisionTest.php.

References $name, $rev, getMockTitle(), and Revision\RAW.


The documentation for this class was generated from the following file: