MediaWiki  1.23.8
DiffHistoryBlobTest.php
Go to the documentation of this file.
1 <?php
2 
4 
5  protected function setUp() {
6  parent::setUp();
7 
8  $this->checkPHPExtension( 'hash' );
9  $this->checkPHPExtension( 'xdiff' );
10 
11  if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
12  $this->markTestSkipped( 'The version of xdiff extension is lower than 1.5.0' );
13 
14  return;
15  }
16  }
17 
23  public function testXdiffAdler32( $input ) {
24  $xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 );
25  $dhb = new DiffHistoryBlob;
26  $myHash = $dhb->xdiffAdler32( $input );
27  $this->assertSame( bin2hex( $xdiffHash ), bin2hex( $myHash ),
28  "Hash of " . addcslashes( $input, "\0..\37!@\@\177..\377" ) );
29  }
30 
31  public static function provideXdiffAdler32() {
32  return array(
33  array( '', 'Empty string' ),
34  array( "\0", 'Null' ),
35  array( "\0\0\0", "Several nulls" ),
36  array( "Hello", "An ASCII string" ),
37  array( str_repeat( "x", 6000 ), "A string larger than xdiff's NMAX (5552)" )
38  );
39  }
40 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
DiffHistoryBlobTest\testXdiffAdler32
testXdiffAdler32( $input)
Test for DiffHistoryBlob::xdiffAdler32() @dataProvider provideXdiffAdler32 @covers DiffHistoryBlob::x...
Definition: DiffHistoryBlobTest.php:23
DiffHistoryBlobTest\setUp
setUp()
Definition: DiffHistoryBlobTest.php:5
DiffHistoryBlobTest\provideXdiffAdler32
static provideXdiffAdler32()
Definition: DiffHistoryBlobTest.php:31
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
DiffHistoryBlobTest
Definition: DiffHistoryBlobTest.php:3
DiffHistoryBlob\xdiffAdler32
xdiffAdler32( $s)
Compute a binary "Adler-32" checksum as defined by LibXDiff, i.e.
Definition: HistoryBlob.php:585
MediaWikiTestCase\checkPHPExtension
checkPHPExtension( $extName)
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
Definition: MediaWikiTestCase.php:1005
DiffHistoryBlob
Diff-based history compression Requires xdiff 1.5+ and zlib.
Definition: HistoryBlob.php:334