mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 14:36:51 +00:00
Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due to T308443. Bug: T308718 Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659 Change-Id: Iebc5768a3125ce2b173e9b55fc3ea20616553824
This commit is contained in:
parent
e67d53611e
commit
bb72bc65f5
|
@ -15,7 +15,7 @@
|
|||
"license-name": "GPL-2.0-or-later",
|
||||
"type": "parserhook",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.38.0"
|
||||
"MediaWiki": ">= 1.39.0"
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"Cite": [
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
namespace Cite\ResourceLoader;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\ResourceLoader\FileModule;
|
||||
|
||||
/**
|
||||
* ResourceLoaderFileModule for adding the content language Cite CSS
|
||||
* ResourceLoader FileModule for adding the content language Cite CSS
|
||||
*
|
||||
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
||||
* @license MIT
|
||||
*/
|
||||
class CiteCSSFileModule extends \ResourceLoaderFileModule {
|
||||
class CiteCSSFileModule extends FileModule {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Cite\ResourceLoader;
|
||||
|
||||
use ResourceLoaderContext;
|
||||
use MediaWiki\ResourceLoader as RL;
|
||||
|
||||
/**
|
||||
* File module with extra data generated by the server.
|
||||
|
@ -12,19 +12,19 @@ use ResourceLoaderContext;
|
|||
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
||||
* @license MIT
|
||||
*/
|
||||
class CiteVisualEditorModule extends \ResourceLoaderFileModule {
|
||||
class CiteVisualEditorModule extends RL\FileModule {
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getScript( ResourceLoaderContext $context ) {
|
||||
public function getScript( RL\Context $context ) {
|
||||
return $this->makePrependedScript( $context ) . parent::getScript( $context );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param ResourceLoaderContext $context
|
||||
* @param RL\Context $context
|
||||
* @return string JavaScript code
|
||||
*/
|
||||
public function makePrependedScript( ResourceLoaderContext $context ) {
|
||||
public function makePrependedScript( RL\Context $context ) {
|
||||
$citationDefinition = json_decode(
|
||||
$context->msg( 'cite-tool-definition.json' )
|
||||
->inContentLanguage()
|
||||
|
@ -61,7 +61,7 @@ class CiteVisualEditorModule extends \ResourceLoaderFileModule {
|
|||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getDefinitionSummary( ResourceLoaderContext $context ) {
|
||||
public function getDefinitionSummary( RL\Context $context ) {
|
||||
$summary = parent::getDefinitionSummary( $context );
|
||||
$summary[] = [
|
||||
'script' => $this->makePrependedScript( $context ),
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Cite\Tests;
|
|||
|
||||
use Cite\ResourceLoader\CiteCSSFileModule;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use ResourceLoaderContext;
|
||||
use MediaWiki\ResourceLoader\Context;
|
||||
|
||||
/**
|
||||
* @covers \Cite\ResourceLoader\CiteCSSFileModule
|
||||
|
@ -24,7 +24,7 @@ class CiteCSSFileModuleTest extends \MediaWikiIntegrationTestCase {
|
|||
|
||||
public function testModule() {
|
||||
$module = new CiteCSSFileModule( [], __DIR__ . '/../../modules' );
|
||||
$styles = $module->getStyleFiles( $this->createMock( ResourceLoaderContext::class ) );
|
||||
$styles = $module->getStyleFiles( $this->createMock( Context::class ) );
|
||||
$this->assertSame( [ 'ext.cite.style.fa.css' ], $styles['all'] );
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace Cite\Tests\Unit;
|
||||
|
||||
use Cite\ResourceLoader\CiteVisualEditorModule;
|
||||
use MediaWiki\ResourceLoader\Context;
|
||||
use Message;
|
||||
use ResourceLoaderContext;
|
||||
|
||||
/**
|
||||
* @covers \Cite\ResourceLoader\CiteVisualEditorModule
|
||||
|
@ -34,7 +34,7 @@ class CiteDataModuleTest extends \MediaWikiUnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
private function createResourceLoaderContext(): ResourceLoaderContext {
|
||||
private function createResourceLoaderContext(): Context {
|
||||
$msg = $this->createMock( Message::class );
|
||||
$msg->method( 'inContentLanguage' )
|
||||
->willReturnSelf();
|
||||
|
@ -43,7 +43,7 @@ class CiteDataModuleTest extends \MediaWikiUnitTestCase {
|
|||
$msg->method( 'text' )
|
||||
->willReturn( 't' );
|
||||
|
||||
$context = $this->createStub( ResourceLoaderContext::class );
|
||||
$context = $this->createStub( Context::class );
|
||||
$context->method( 'msg' )
|
||||
->withConsecutive(
|
||||
[ 'cite-tool-definition.json' ],
|
||||
|
|
Loading…
Reference in a new issue