mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-03 19:16:09 +00:00
a176e22097
This API was never used in Wikimedia production, and would have caused performance problems. Removing the dead code will simplify our refactoring. Bug: T238195 Change-Id: I7088f257ec034c0d089e0abdaa5a739910598300
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
use Cite\Hooks\CiteHooks;
|
|
use HashConfig;
|
|
use ResourceLoader;
|
|
use Title;
|
|
|
|
/**
|
|
* @coversDefaultClass \Cite\Hooks\CiteHooks
|
|
*
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
class CiteHooksUnitTest extends \MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::onContentHandlerDefaultModelFor
|
|
*/
|
|
public function testOnContentHandlerDefaultModelFor() {
|
|
$title = $this->createMock( Title::class );
|
|
$title->method( 'inNamespace' )
|
|
->willReturn( true );
|
|
$title->method( 'getText' )
|
|
->willReturn( 'Cite-tool-definition.json' );
|
|
|
|
CiteHooks::onContentHandlerDefaultModelFor( $title, $model );
|
|
|
|
$this->assertSame( CONTENT_MODEL_JSON, $model );
|
|
}
|
|
|
|
/**
|
|
* @covers ::onResourceLoaderTestModules
|
|
*/
|
|
public function testOnResourceLoaderTestModules() {
|
|
$testModules = [];
|
|
$resourceLoader = $this->createMock( ResourceLoader::class );
|
|
$resourceLoader->method( 'getConfig' )
|
|
->willReturn( new HashConfig( [
|
|
'ResourceModules' => [ 'ext.visualEditor.mediawiki' => true ],
|
|
] ) );
|
|
|
|
CiteHooks::onResourceLoaderTestModules( $testModules, $resourceLoader );
|
|
|
|
$this->assertArrayHasKey( 'ext.cite.visualEditor.test', $testModules['qunit'] );
|
|
}
|
|
|
|
/**
|
|
* @covers ::onResourceLoaderRegisterModules
|
|
*/
|
|
public function testOnResourceLoaderRegisterModules() {
|
|
$resourceLoader = $this->createMock( ResourceLoader::class );
|
|
$resourceLoader->expects( $this->atLeastOnce() )
|
|
->method( 'register' );
|
|
|
|
CiteHooks::onResourceLoaderRegisterModules( $resourceLoader );
|
|
}
|
|
|
|
}
|