mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-25 13:02:54 +00:00
2ff327df53
> We lose useful coverage and spend valuable time keeping these tags > accurate through refactors (or worse, forget to do so). > > I am not disabling the "only track coverage of specified subject" > benefits, nor am I claiming coverage in in classes outside the > subject under test. > > Tracking tiny per-method details wastes time in keeping tags > in sync during refactors, and time to realize (and fix) when people > inevitably don't keep them in sync, and time lost in finding > uncovered code to write tests for only to realize it was already > covered but "not yet claimed". https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:%2522Widen%2522 Change-Id: Iafa241210b81ba1cbfee74e3920fb044c86d09fc
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Cite\Tests;
|
|
|
|
use ApiQuerySiteinfo;
|
|
use Cite\Hooks\CiteHooks;
|
|
use MediaWiki\User\Options\StaticUserOptionsLookup;
|
|
|
|
/**
|
|
* @covers \Cite\Hooks\CiteHooks
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
class CiteHooksTest extends \MediaWikiIntegrationTestCase {
|
|
|
|
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 );
|
|
}
|
|
|
|
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 );
|
|
}
|
|
|
|
}
|