2022-10-13 15:24:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\VisualEditor\Tests;
|
|
|
|
|
2024-02-20 09:46:48 +00:00
|
|
|
use MediaWiki\Config\HashConfig;
|
2022-10-13 15:24:07 +00:00
|
|
|
use MediaWiki\Extension\VisualEditor\Hooks;
|
|
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \MediaWiki\Extension\VisualEditor\Hooks
|
|
|
|
* @group Database
|
|
|
|
*/
|
|
|
|
class HooksTest extends MediaWikiIntegrationTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider provideOnResourceLoaderGetConfigVars
|
|
|
|
*/
|
|
|
|
public function testOnResourceLoaderGetConfigVars( array $config, array $expected ) {
|
|
|
|
$this->overrideConfigValues( $config );
|
|
|
|
|
|
|
|
$vars = [];
|
2024-02-20 09:46:48 +00:00
|
|
|
( new Hooks() )->onResourceLoaderGetConfigVars( $vars, '', new HashConfig() );
|
2022-10-13 15:24:07 +00:00
|
|
|
|
|
|
|
$this->assertArrayHasKey( 'wgVisualEditorConfig', $vars );
|
|
|
|
$veConfig = $vars['wgVisualEditorConfig'];
|
|
|
|
|
|
|
|
foreach ( $expected as $name => $value ) {
|
|
|
|
$this->assertArrayHasKey( $name, $veConfig );
|
|
|
|
$this->assertSame( $value, $veConfig[$name] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-20 15:02:35 +00:00
|
|
|
public static function provideOnResourceLoaderGetConfigVars() {
|
2024-02-20 09:46:48 +00:00
|
|
|
yield [ [], [] ];
|
2022-10-13 15:24:07 +00:00
|
|
|
// TODO: test a lot more config!
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|