mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-12 07:05:09 +00:00
8e4c83bfc6
Puts the ReferencePreviewsContext behind a service to improve testability. Bug: T363162 Change-Id: I63aa4144081a2625da1b89f4d56adb612741c8fc
33 lines
796 B
PHP
33 lines
796 B
PHP
<?php
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
use Cite\Hooks\CiteHooks;
|
|
use Cite\ReferencePreviews\ReferencePreviewsContext;
|
|
use MediaWiki\Title\Title;
|
|
use MediaWiki\User\Options\StaticUserOptionsLookup;
|
|
|
|
/**
|
|
* @covers \Cite\Hooks\CiteHooks
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
class CiteHooksUnitTest extends \MediaWikiUnitTestCase {
|
|
|
|
public function testOnContentHandlerDefaultModelFor() {
|
|
$title = $this->createMock( Title::class );
|
|
$title->method( 'inNamespace' )
|
|
->willReturn( true );
|
|
$title->method( 'getText' )
|
|
->willReturn( 'Cite-tool-definition.json' );
|
|
|
|
( new CiteHooks(
|
|
$this->createMock( ReferencePreviewsContext::class ),
|
|
new StaticUserOptionsLookup( [] )
|
|
) )
|
|
->onContentHandlerDefaultModelFor( $title, $model );
|
|
|
|
$this->assertSame( CONTENT_MODEL_JSON, $model );
|
|
}
|
|
|
|
}
|