wiki.techinc.nl/tests/phpunit/structure/ForeignResourceStructureTest.php
Amir Sarabadani 719ce204a0 Reorg: Move ForeignResourceManager to ResourceLoader directory
It literally has @ingroup ResourceLoader

Bug: T321882
Change-Id: Ia5c7c56c9235f98754f6d5e602da4626a76ff083
2022-11-08 10:54:17 +01:00

38 lines
1 KiB
PHP

<?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" );
}
}