Wikimedia\restoreWarnings();
}
- public function provideGetRevisionText() {
- yield 'Generic test' => [
- 'This is a goat of revision text.',
- [
- 'old_flags' => '',
- 'old_text' => 'This is a goat of revision text.',
- ],
- ];
- }
-
public function provideGetId() {
yield [
[],
$this->assertSame( $expected, $rev->getParentId() );
}
+ public function provideGetRevisionText() {
+ yield 'Generic test' => [
+ 'This is a goat of revision text.',
+ (object)[
+ 'old_flags' => '',
+ 'old_text' => 'This is a goat of revision text.',
+ ],
+ ];
+ yield 'garbage in, garbage out' => [
+ false,
+ false,
+ ];
+ }
+
/**
* @covers Revision::getRevisionText
* @dataProvider provideGetRevisionText
public function testGetRevisionText( $expected, $rowData, $prefix = 'old_', $wiki = false ) {
$this->assertEquals(
$expected,
- Revision::getRevisionText( (object)$rowData, $prefix, $wiki ) );
+ Revision::getRevisionText( $rowData, $prefix, $wiki ) );
}
public function provideGetRevisionTextWithZlibExtension() {
yield 'Generic gzip test' => [
'This is a small goat of revision text.',
- [
+ (object)[
'old_flags' => 'gzip',
'old_text' => gzdeflate( 'This is a small goat of revision text.' ),
],
public function provideGetRevisionTextWithZlibExtension_badData() {
yield 'Generic gzip test' => [
'This is a small goat of revision text.',
- [
+ (object)[
'old_flags' => 'gzip',
'old_text' => 'DEAD BEEF',
],
"Wiki est l'\xc3\xa9cole superieur !",
'fr',
'iso-8859-1',
- [
+ (object)[
'old_flags' => 'utf-8',
'old_text' => "Wiki est l'\xc3\xa9cole superieur !",
]
"Wiki est l'\xc3\xa9cole superieur !",
'fr',
'iso-8859-1',
- [
+ (object)[
'old_flags' => '',
'old_text' => "Wiki est l'\xe9cole superieur !",
]
"Wiki est l'\xc3\xa9cole superieur !",
'fr',
'iso-8859-1',
- [
+ (object)[
'old_flags' => 'gzip,utf-8',
'old_text' => gzdeflate( "Wiki est l'\xc3\xa9cole superieur !" ),
]
"Wiki est l'\xc3\xa9cole superieur !",
'fr',
'iso-8859-1',
- [
+ (object)[
'old_flags' => 'gzip',
'old_text' => gzdeflate( "Wiki est l'\xe9cole superieur !" ),
]
*/
public function testLoadFromTitle() {
$this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
- $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', MIGRATION_OLD );
+ $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', SCHEMA_COMPAT_OLD );
$this->overrideMwServices();
$title = $this->getMockTitle();
'rev_content_model' => 'GOATMODEL',
];
+ $domain = MediaWikiServices::getInstance()->getDBLoadBalancer()->getLocalDomainID();
$db = $this->getMock( IDatabase::class );
$db->expects( $this->any() )
->method( 'getDomainId' )
- ->will( $this->returnValue( wfWikiID() ) );
+ ->will( $this->returnValue( $domain ) );
$db->expects( $this->once() )
->method( 'selectRow' )
->with(
);
}
- /**
- * @covers Revision::getRevisionText
- */
- public function testGetRevisionText_returnsFalseWhenNoTextField() {
- $this->assertFalse( Revision::getRevisionText( new stdClass() ) );
- }
-
public function provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal() {
yield 'Just text' => [
(object)[ 'old_text' => 'SomeText' ],