/**
* @covers FileContentsHasherTest
*/
-class FileContentsHasherTest extends MediaWikiTestCase {
+class FileContentsHasherTest extends PHPUnit\Framework\TestCase {
+
+ use MediaWikiCoversValidator;
public function provideSingleFile() {
return array_map( function ( $file ) {
- return array( $file, file_get_contents( $file ) );
+ return [ $file, file_get_contents( $file ) ];
}, glob( __DIR__ . '/../../data/filecontentshasher/*.*' ) );
}
public function provideMultipleFiles() {
- return array(
- array( $this->provideSingleFile() )
- );
+ return [
+ [ $this->provideSingleFile() ]
+ ];
}
/**
- * @covers FileContentsHasher::getFileContentHash
+ * @covers FileContentsHasher::getFileContentsHash
* @covers FileContentsHasher::getFileContentsHashInternal
* @dataProvider provideSingleFile
*/
public function testSingleFileHash( $fileName, $contents ) {
- foreach ( array( 'md4', 'md5' ) as $algo ) {
+ foreach ( [ 'md4', 'md5' ] as $algo ) {
$expectedHash = hash( $algo, $contents );
$actualHash = FileContentsHasher::getFileContentsHash( $fileName, $algo );
$this->assertEquals( $expectedHash, $actualHash );
}
/**
- * @covers FileContentsHasher::getFileContentHash
+ * @covers FileContentsHasher::getFileContentsHash
* @covers FileContentsHasher::getFileContentsHashInternal
* @dataProvider provideMultipleFiles
*/
public function testMultipleFileHash( $files ) {
- $fileNames = array();
- $hashes = array();
+ $fileNames = [];
+ $hashes = [];
foreach ( $files as $fileInfo ) {
list( $fileName, $contents ) = $fileInfo;
$fileNames[] = $fileName;