mediawiki-extensions-Cite/tests/phpunit/unit/CiteHooksUnitTest.php
Adam Wight c7b60735fe Move Reference Previews user preference into the Cite extension
This seems to play well with Popups with and without
Ie8fa1672b9fd .  However, it's not clear to me why this still works
and even gives priority to the Popups implementation when present,
regardless of the order the extensions are loaded in.  Happily, this
is the desired behavior.

Bug: T363162
Change-Id: Ic479c0a381ee16d1abcecfdd5ee48f0afccc1d3f
2024-09-10 15:33:50 +02:00

35 lines
928 B
PHP

<?php
namespace Cite\Tests\Unit;
use Cite\Hooks\CiteHooks;
use Cite\ReferencePreviews\ReferencePreviewsContext;
use Cite\ReferencePreviews\ReferencePreviewsGadgetsIntegration;
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 ),
$this->createMock( ReferencePreviewsGadgetsIntegration::class ),
new StaticUserOptionsLookup( [] )
) )
->onContentHandlerDefaultModelFor( $title, $model );
$this->assertSame( CONTENT_MODEL_JSON, $model );
}
}