mediawiki-extensions-Cite/tests/phpunit/CiteHooksTest.php
gerritbot 3d34307f87 Update StaticUserOptionsLookup's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I42653491c19dde5de99e0661770e2c81df5d7e84
Change-Id: I22ff2effcf9b7f2162f5d57608d8ec3651b48dd7
2023-11-29 17:55:07 +00:00

49 lines
1.2 KiB
PHP

<?php
namespace Cite\Tests;
use ApiQuerySiteinfo;
use Cite\Hooks\CiteHooks;
use MediaWiki\User\Options\StaticUserOptionsLookup;
/**
* @coversDefaultClass \Cite\Hooks\CiteHooks
*
* @license GPL-2.0-or-later
*/
class CiteHooksTest extends \MediaWikiIntegrationTestCase {
/**
* @covers ::onResourceLoaderGetConfigVars
*/
public function testOnResourceLoaderGetConfigVars() {
$vars = [];
$config = $this->getServiceContainer()->getMainConfig();
$citeHooks = new CiteHooks( new StaticUserOptionsLookup( [] ) );
$citeHooks->onResourceLoaderGetConfigVars( $vars, 'vector', $config );
$this->assertArrayHasKey( 'wgCiteVisualEditorOtherGroup', $vars );
$this->assertArrayHasKey( 'wgCiteResponsiveReferences', $vars );
}
/**
* @covers ::onAPIQuerySiteInfoGeneralInfo
*/
public function testOnAPIQuerySiteInfoGeneralInfo() {
$api = $this->createMock( ApiQuerySiteinfo::class );
$api->expects( $this->once() )
->method( 'getConfig' )
->willReturn( $this->getServiceContainer()->getMainConfig() );
$data = [];
$citeHooks = new CiteHooks( new StaticUserOptionsLookup( [] ) );
$citeHooks->onAPIQuerySiteInfoGeneralInfo( $api, $data );
$this->assertArrayHasKey( 'citeresponsivereferences', $data );
}
}