mediawiki-extensions-Visual.../tests/phpunit/integration/HooksTest.php
msantos 1647a0ae89 Skip tests while renaming HTMLTransform
HTMLTransform is being renamed at I506f3303ae8f9e4db17299211366bef1558f142c.
This is a temporary measure to allow CI to succeed in the core patch

Change-Id: Id11068e34d4b3ed6ccc210c91e449656e74138a2
2022-10-22 19:55:55 +00:00

82 lines
2 KiB
PHP

<?php
namespace MediaWiki\Extension\VisualEditor\Tests;
use MediaWiki\Extension\VisualEditor\Hooks;
use MediaWikiIntegrationTestCase;
/**
* @covers \MediaWiki\Extension\VisualEditor\Hooks
* @group Database
*/
class HooksTest extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
parent::setUp();
$this->markTestSkipped(
'Temporarily skip test while renaming HTMLTransform at I506f3303ae8f9e4db17299211366bef1558f142c'
);
}
/**
* @dataProvider provideOnResourceLoaderGetConfigVars
*/
public function testOnResourceLoaderGetConfigVars( array $config, array $expected ) {
$this->overrideConfigValues( $config );
$vars = [];
Hooks::onResourceLoaderGetConfigVars( $vars );
$this->assertArrayHasKey( 'wgVisualEditorConfig', $vars );
$veConfig = $vars['wgVisualEditorConfig'];
foreach ( $expected as $name => $value ) {
$this->assertArrayHasKey( $name, $veConfig );
$this->assertSame( $value, $veConfig[$name] );
}
}
public function provideOnResourceLoaderGetConfigVars() {
// TODO: test a lot more config!
yield 'restbaseUrl: No VRS modules' => [
[
'VirtualRestConfig' => [ 'modules' => [] ],
'VisualEditorRestbaseURL' => 'parsoid-url',
'VisualEditorFullRestbaseURL' => 'full-parsoid-url',
],
[
'restbaseUrl' => false,
'fullRestbaseUrl' => false,
]
];
yield 'restbaseUrl: VRS modules available' => [
[
'VirtualRestConfig' => [ 'modules' => [
'parsoid' => true,
] ],
'VisualEditorRestbaseURL' => 'parsoid-url',
'VisualEditorFullRestbaseURL' => 'full-parsoid-url',
],
[
'restbaseUrl' => 'parsoid-url',
'fullRestbaseUrl' => 'full-parsoid-url',
]
];
yield 'restbaseUrl: VRS modules available, but no direct access URLs' => [
[
'VirtualRestConfig' => [ 'modules' => [
'parsoid' => true,
] ],
'VisualEditorRestbaseURL' => 'parsoid-url',
'VisualEditorFullRestbaseURL' => 'full-parsoid-url',
],
[
'restbaseUrl' => 'parsoid-url',
'fullRestbaseUrl' => 'full-parsoid-url',
]
];
}
}