mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-30 17:54:20 +00:00
c35d47fe0b
CI already ensures that VisualEditor is loaded alongside Cite, so the defensive check in the code isn't needed; ext.cite.visualEditor is defined statically, it's just injected into the page dynamically in the VisualEditor code handling VisualEditorPluginModules. Bug: T232875 Change-Id: Ie5e096feca92f9c3ef13c732f3f1ae491e2b7d03
43 lines
980 B
PHP
43 lines
980 B
PHP
<?php
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
use Cite\Hooks\CiteHooks;
|
|
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 ::onResourceLoaderRegisterModules
|
|
*/
|
|
public function testOnResourceLoaderRegisterModules() {
|
|
$resourceLoader = $this->createMock( ResourceLoader::class );
|
|
$resourceLoader->expects( $this->atLeastOnce() )
|
|
->method( 'register' );
|
|
|
|
CiteHooks::onResourceLoaderRegisterModules( $resourceLoader );
|
|
}
|
|
|
|
}
|