mediawiki-extensions-Cite/tests/phpunit/CiteCSSFileModuleTest.php
thiemowmde 5ef0ccdaa6 Drop redundant fallbacks from parsoid-styles directory
These .less files are pointless because these languages have
fallbacks, and the .less file for the fallback is identical. The
behavior on the cluster will not change when we remove these
files. Another file with the same rules will be loaded instead.

I made this patch algorithmically by writing a piece of code that
iterates all existing .less files, checks if the language does
have fallbacks, and if one of the fallback .less files is
identical.

I also updated the existing test case to reflect what's going on.

Change-Id: Iab647956f7bf45e59da1af33ff2b3e81ad016b4c
2024-07-19 15:00:01 +02:00

30 lines
717 B
PHP

<?php
namespace Cite\Tests;
use Cite\ResourceLoader\CiteCSSFileModule;
use MediaWiki\ResourceLoader\Context;
/**
* @covers \Cite\ResourceLoader\CiteCSSFileModule
* @license GPL-2.0-or-later
*/
class CiteCSSFileModuleTest extends \MediaWikiIntegrationTestCase {
protected function setUp(): void {
parent::setUp();
$this->setService(
'ContentLanguage',
$this->getServiceContainer()->getLanguageFactory()->getLanguage( 'wa' )
);
}
public function testModule() {
$module = new CiteCSSFileModule( [], __DIR__ . '/../../modules/parsoid-styles' );
$styles = $module->getStyleFiles( $this->createMock( Context::class ) );
$this->assertSame( [ 'ext.cite.style.fr.less' ], $styles['all'] );
}
}