wiki.techinc.nl/tests/phpunit/integration/includes/ResourceLoader/ForeignResourceStructureTest.php
Timo Tijhof 1911c8fc27 ResourceLoader: Move ForeignResourceStructureTest to integration/
Follows-up I071be5821711f (2cf45bc934) and I8aeffc1f2e81 (3270283abf).

Avoid use of `@standalone` in core, since that group is only
special-cased in WMF CI for extension and skin repos.

Core tests, unlike extension tests, are already skipped by default
when running PHPUnit in CI for extension and skin repos. The exception
is the structure/ directory which is for general system-wide checks
that may also cover installed skins and extentensions.

Given that this test only covers core, and that's why we want to
skip it, move it out of structure/.

Bug: T203694
Change-Id: I7431e5627861845f9d49afc4777b76052d3a6e77
2023-03-29 14:14:55 -07:00

42 lines
1.2 KiB
PHP

<?php
use MediaWiki\ResourceLoader\ForeignResourceManager;
/**
* Verify MediaWiki core's foreign-resources.yaml.
*
* This test is under integration/ instead of structure/ because the latter
* also runs in CI for skin and extension repos (T203694).
*
* @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" );
}
}