mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-25 06:03:10 +00:00
20b9d04b2f
- Add ModulesSizeTest.php that checks the total loaded scripts and styles budget sizes and checks if they exceed the budgets assigned in bundlesize.config.json. - Changed the json structure of bundlesize.config.json to support both ModulesSizeTest.php and BundleSizeTest.php. - Handled the new data structure in the BundleSizeTest.php so the dataProvider gets proper data. Bug: T346813 Change-Id: Id5c28ecec20c4a74a113dd8781b6a022391ae443
20 lines
542 B
PHP
20 lines
542 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Skins\Vector\Tests\Structure;
|
|
|
|
class BundleSizeTest extends \MediaWiki\Tests\Structure\BundleSizeTest {
|
|
|
|
/** @inheritDoc */
|
|
public function getBundleSizeConfig(): string {
|
|
return dirname( __DIR__, 3 ) . '/bundlesize.config.json';
|
|
}
|
|
|
|
/** @inheritDoc */
|
|
public function provideBundleSize() {
|
|
$bundleSizeConfig = json_decode( file_get_contents( $this->getBundleSizeConfig() ), true );
|
|
foreach ( $bundleSizeConfig[ 'modules' ] as $testCase ) {
|
|
yield $testCase['resourceModule'] => [ $testCase ];
|
|
}
|
|
}
|
|
}
|