| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\VisualEditor\Tests; |
| 4 |
|
| 5 |
use MediaWiki\Config\HashConfig; |
| 6 |
use MediaWiki\Extension\VisualEditor\Hooks; |
| 7 |
use MediaWikiIntegrationTestCase; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class HooksTest extends MediaWikiIntegrationTestCase { |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public function testOnResourceLoaderGetConfigVars( array $config, array $expected ) { |
| 19 |
$this->overrideConfigValues( $config ); |
| 20 |
|
| 21 |
$vars = []; |
| 22 |
( new Hooks() )->onResourceLoaderGetConfigVars( $vars, '', new HashConfig() ); |
| 23 |
|
| 24 |
$this->assertArrayHasKey( 'wgVisualEditorConfig', $vars ); |
| 25 |
$veConfig = $vars['wgVisualEditorConfig']; |
| 26 |
|
| 27 |
foreach ( $expected as $name => $value ) { |
| 28 |
$this->assertArrayHasKey( $name, $veConfig ); |
| 29 |
$this->assertSame( $value, $veConfig[$name] ); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
public static function provideOnResourceLoaderGetConfigVars() { |
| 34 |
yield [ [], [] ]; |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
} |