$this->testGetRevisionText( $expected, $rowData );
}
+ public function provideGetRevisionTextWithZlibExtension_badData() {
+ yield 'Generic gzip test' => [
+ 'This is a small goat of revision text.',
+ [
+ 'old_flags' => 'gzip',
+ 'old_text' => 'DEAD BEEF',
+ ],
+ ];
+ }
+
+ /**
+ * @covers Revision::getRevisionText
+ * @dataProvider provideGetRevisionTextWithZlibExtension_badData
+ */
+ public function testGetRevisionWithZlibExtension_badData( $expected, $rowData ) {
+ $this->checkPHPExtension( 'zlib' );
+ Wikimedia\suppressWarnings();
+ $this->assertFalse(
+ Revision::getRevisionText(
+ (object)$rowData
+ )
+ );
+ Wikimedia\suppressWarnings( true );
+ }
+
private function getWANObjectCache() {
return new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
}
public function testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts(
$text
) {
+ Wikimedia\suppressWarnings();
$this->assertFalse(
Revision::getRevisionText(
(object)[
]
)
);
+ Wikimedia\suppressWarnings( true );
}
/**
)
);
- $cacheKey = $cache->makeKey( 'revisiontext', 'textid', 'tt:7777' );
+ $cacheKey = $cache->makeGlobalKey(
+ 'BlobStore',
+ 'address',
+ $lb->getLocalDomainID(),
+ 'tt:7777'
+ );
$this->assertSame( 'AAAABBAAA', $cache->get( $cacheKey ) );
}