wiki.techinc.nl/tests/phpunit/structure/ForeignResourceStructureTest.php

39 lines
1 KiB
PHP
Raw Normal View History

<?php
use MediaWiki\ResourceLoader\ForeignResourceManager;
/**
* @group Standalone
* @coversNothing
*/
class ForeignResourceStructureTest extends \PHPUnit\Framework\TestCase {
public function testVerifyIntegrity() {
global $IP;
$out = '';
$frm = new ForeignResourceManager(
"{$IP}/resources/lib/foreign-resources.yaml",
"{$IP}/resources/lib",
static function ( $text ) use ( &$out ) {
$out .= $text;
}
);
// The "verify" action verifies two things:
// 1. Mismatching SRI hashes.
// These throw an exception with the actual/expect values
// to place in foreign-resources.yaml.
// 2. Mismatching file contents.
// These print messages about each mismatching file,
// and then we add our help text afterward for how to
// automatically update the file resources.
$helpUpdate = '
To update a foreign resource, run:
$ php maintenance/manageForeignResources.php update <moduleName>
';
$this->assertTrue( $frm->run( 'verify', 'all' ), "$out\n$helpUpdate" );
}
}