PHPUnit 3.7.0 was the first version to support @requires extension. At
the time checkPHPExtension() was added in a7901801b4, MediaWiki
still supported PHPUnit 3.6.7.
MediaWiki now requires intl and xml, so I removed checks for those
extensions rather than converting them to annotations.
checkPHPExtension() is removed without deprecation; it does not appear
to have ever been used (and is not likely to be used) in MW extensions.
This is explicitly permitted under the stable interface policy. Even if
it were not, only tests are affected, and they are supposed to fail
anyway if hard deprecated code is used.
Change-Id: I45f9b4c0e120683103cead916f4d4ef58bd11530
28 lines
765 B
PHP
28 lines
765 B
PHP
<?php
|
|
|
|
/**
|
|
* @requires extension xdiff
|
|
*/
|
|
class DiffHistoryBlobTest extends MediaWikiUnitTestCase {
|
|
/**
|
|
* @dataProvider provideXdiffAdler32
|
|
* @covers DiffHistoryBlob::xdiffAdler32
|
|
*/
|
|
public function testXdiffAdler32( $input ) {
|
|
$xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 );
|
|
$dhb = new DiffHistoryBlob;
|
|
$myHash = $dhb->xdiffAdler32( $input );
|
|
$this->assertSame( bin2hex( $xdiffHash ), bin2hex( $myHash ),
|
|
"Hash of " . addcslashes( $input, "\0..\37!@\@\177..\377" ) );
|
|
}
|
|
|
|
public function provideXdiffAdler32() {
|
|
return [
|
|
[ '', 'Empty string' ],
|
|
[ "\0", 'Null' ],
|
|
[ "\0\0\0", "Several nulls" ],
|
|
[ "Hello", "An ASCII string" ],
|
|
[ str_repeat( "x", 6000 ), "A string larger than xdiff's NMAX (5552)" ]
|
|
];
|
|
}
|
|
}
|