Skip to content

Commit

Permalink
Merge "client: Rename Scribunto_LuaWikibase*Library to remove undersc…
Browse files Browse the repository at this point in the history
…ore"
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Oct 11, 2024
2 parents 22aa60e + 47d3b00 commit 3f84973
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 39 deletions.
11 changes: 4 additions & 7 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,21 @@
</rule>

<rule ref="Generic.Classes.DuplicateClassName">
<exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase</exclude-pattern>
<exclude-pattern>WikibaseLibraryTestCase</exclude-pattern>
</rule>
<!-- NOTE: We purposely decided against additional Generic.CodeAnalysis.… sniffs, because they
all have possible exceptions, and are not meant to block patches from being merged. -->
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement">
<exclude-pattern>WikibaseClient\.example\.php</exclude-pattern>
</rule>
<rule ref="Generic.Files.OneObjectStructurePerFile">
<exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase</exclude-pattern>
<exclude-pattern>WikibaseLibraryTestCase</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>Scribunto_LuaWikibase*</exclude-pattern>
<exclude-pattern>WikibaseLibraryTestCase</exclude-pattern>
</rule>
<rule ref="MediaWiki.Commenting.LicenseComment.LicenseTagNonFileComment">
<exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase\.php</exclude-pattern>
<exclude-pattern>WikibaseLibraryTestCase\.php</exclude-pattern>
<exclude-pattern>DispatchingQueryBuilderTest\.php</exclude-pattern>
</rule>
<rule ref="MediaWiki.Commenting.PhpunitAnnotations.NotClassTrait">
Expand Down
8 changes: 4 additions & 4 deletions client/includes/ClientHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use MediaWiki\Title\Title;
use MediaWiki\User\User;
use Skin;
use Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary;
use Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary;
use Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary;
use Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary;
use Wikibase\Client\Hooks\SkinAfterBottomScriptsHandler;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\EntityIdParsingException;
Expand Down Expand Up @@ -45,8 +45,8 @@ protected static function isWikibaseEnabled( $namespace ) {
public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) {
$allowDataTransclusion = WikibaseClient::getSettings()->getSetting( 'allowDataTransclusion' );
if ( $engine == 'lua' && $allowDataTransclusion === true ) {
$extraLibraries['mw.wikibase'] = Scribunto_LuaWikibaseLibrary::class;
$extraLibraries['mw.wikibase.entity'] = Scribunto_LuaWikibaseEntityLibrary::class;
$extraLibraries['mw.wikibase'] = WikibaseLibrary::class;
$extraLibraries['mw.wikibase.entity'] = WikibaseEntityLibrary::class;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Marius Hoch < [email protected] >
* @author Andrew Hall
*/
class Scribunto_LuaWikibaseEntityLibrary extends LibraryBase implements ParserOutputProvider {
class WikibaseEntityLibrary extends LibraryBase implements ParserOutputProvider {

/**
* @var WikibaseLuaEntityBindings|null
Expand Down Expand Up @@ -313,3 +313,6 @@ public function getParserOutput(): ParserOutput {
return $this->getParser()->getOutput();
}
}

/** @deprecated class alias since 1.43 */
class_alias( WikibaseEntityLibrary::class, 'Wikibase\\Client\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseEntityLibrary' );
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
* @license GPL-2.0-or-later
*/
class Scribunto_LuaWikibaseLibrary extends LibraryBase implements ParserOutputProvider {
class WikibaseLibrary extends LibraryBase implements ParserOutputProvider {

/**
* @var WikibaseLanguageIndependentLuaBindings|null
Expand Down Expand Up @@ -766,3 +766,6 @@ public function getParserOutput(): ParserOutput {
return $this->getParser()->getOutput();
}
}

/** @deprecated class alias since 1.43 */
class_alias( WikibaseLibrary::class, 'Wikibase\\Client\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseLibrary' );
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
use MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreterFunction;
use ParserOptions;
use Wikibase\Client\DataAccess\Scribunto\LuaFunctionCallTracker;
use Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary;
use Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary;
use Wikibase\Client\WikibaseClient;
use Wikibase\Lib\WikibaseSettings;
use Wikimedia\TestingAccessWrapper;

/**
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -25,7 +25,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch < [email protected] >
*/
class Scribunto_LuaWikibaseEntityLibraryTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseEntityLibraryTest extends WikibaseLibraryTestCase {

/**
* @var bool
Expand Down Expand Up @@ -65,8 +65,8 @@ public static function allowDataAccessInUserLanguageProvider() {

public function testConstructor() {
$engine = $this->getEngine();
$luaWikibaseLibrary = new Scribunto_LuaWikibaseEntityLibrary( $engine );
$this->assertInstanceOf( Scribunto_LuaWikibaseEntityLibrary::class, $luaWikibaseLibrary );
$luaWikibaseLibrary = new WikibaseEntityLibrary( $engine );
$this->assertInstanceOf( WikibaseEntityLibrary::class, $luaWikibaseLibrary );
}

public function testRegister() {
Expand Down Expand Up @@ -285,7 +285,7 @@ public function testIncrementStatsKey() {
* @param bool &$cacheSplit Will become true when the ParserCache has been split
* @param Language|null $userLang The user's language
*
* @return Scribunto_LuaWikibaseEntityLibrary
* @return WikibaseEntityLibrary
*/
private function newScribuntoLuaWikibaseLibrary( &$cacheSplit = false, Language $userLang = null ) {
/** @var $engine LuaEngine */
Expand All @@ -307,7 +307,7 @@ function( $optionName ) use ( &$cacheSplit ) {
}
);

return new Scribunto_LuaWikibaseEntityLibrary( $engine );
return new WikibaseEntityLibrary( $engine );
}

private function setAllowDataAccessInUserLanguage( bool $value ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Verifies that arbitrary data access doesn't work, if it's disabled.
*
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -21,7 +21,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch < [email protected] >
*/
class Scribunto_LuaWikibaseLibraryInProcessEntityCacheTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseLibraryInProcessEntityCacheTest extends WikibaseLibraryTestCase {

/** @inheritDoc */
protected static $moduleName = 'LuaWikibaseLibraryInProcessEntityCacheTests';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Verifies that arbitrary data access doesn't work, if it's disabled.
*
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -16,7 +16,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch < [email protected] >
*/
class Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseLibraryNoArbitraryAccessTest extends WikibaseLibraryTestCase {

/** @inheritDoc */
protected static $moduleName = 'LuaWikibaseLibraryNoArbitraryAccessTests';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Tests for pages that are not connected to any Item.
*
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -18,7 +18,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch < [email protected] >
*/
class Scribunto_LuaWikibaseLibraryNoLinkedEntityTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseLibraryNoLinkedEntityTest extends WikibaseLibraryTestCase {

/** @inheritDoc */
protected static $moduleName = 'LuaWikibaseLibraryNoLinkedEntityTests';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use MediaWiki\Extension\Scribunto\ScribuntoException;
use ParserOptions;
use Wikibase\Client\DataAccess\Scribunto\LuaFunctionCallTracker;
use Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary;
use Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary;
use Wikibase\Client\RepoLinker;
use Wikibase\Client\WikibaseClient;
use Wikibase\DataModel\Entity\ItemId;
Expand All @@ -20,7 +20,7 @@
use Wikimedia\TestingAccessWrapper;

/**
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -33,7 +33,7 @@
* @author Marius Hoch < [email protected] >
* @author Lucie-Aimée Kaffee
*/
class Scribunto_LuaWikibaseLibraryTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseLibraryTest extends WikibaseLibraryTestCase {

/** @inheritDoc */
protected static $moduleName = 'LuaWikibaseLibraryTests';
Expand Down Expand Up @@ -79,8 +79,8 @@ public static function allowDataAccessInUserLanguageProvider() {

public function testConstructor() {
$engine = $this->getEngine();
$luaWikibaseLibrary = new Scribunto_LuaWikibaseLibrary( $engine );
$this->assertInstanceOf( Scribunto_LuaWikibaseLibrary::class, $luaWikibaseLibrary );
$luaWikibaseLibrary = new WikibaseLibrary( $engine );
$this->assertInstanceOf( WikibaseLibrary::class, $luaWikibaseLibrary );
}

public function testRegister() {
Expand Down Expand Up @@ -603,7 +603,7 @@ private function getPropertyOrderProvider( array $propertyOrder ): PropertyOrder
private function newScribuntoLuaWikibaseLibrary(
bool &$cacheSplit = false,
?Language $userLang = null
): Scribunto_LuaWikibaseLibrary {
): WikibaseLibrary {
/** @var $engine LuaEngine */
$engine = $this->getEngine();
$engine->load();
Expand All @@ -623,7 +623,7 @@ function( $optionName ) use ( &$cacheSplit ) {
}
);

return new Scribunto_LuaWikibaseLibrary( $engine );
return new WikibaseLibrary( $engine );
}

private function setAllowDataAccessInUserLanguage( bool $value ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch < [email protected] >
*/
abstract class Scribunto_LuaWikibaseLibraryTestCase extends \PHPUnit\Framework\TestCase {
abstract class WikibaseLibraryTestCase extends \PHPUnit\Framework\TestCase {

protected function setUp(): void {
$this->markTestSkipped( 'Scribunto is not available' );
Expand Down Expand Up @@ -49,7 +49,7 @@ public function testPlaceholder() {
* @author Marius Hoch < [email protected] >
* @author Daniel Kinzler
*/
abstract class Scribunto_LuaWikibaseLibraryTestCase extends LuaEngineTestBase {
abstract class WikibaseLibraryTestCase extends LuaEngineTestBase {

/**
* @var bool|null
Expand Down Expand Up @@ -193,3 +193,7 @@ protected static function getEntityAccessLimit() {
}

}

/** @deprecated class alias since 1.43 */
class_alias( WikibaseLibraryTestCase::class,
'Wikibase\\Client\\Tests\\Integration\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseLibraryTestCase' );
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* Integration test for statsd tracking.
*
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary
* @covers \Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary
*
* @group WikibaseScribunto
* @group WikibaseIntegration
Expand All @@ -19,7 +19,7 @@
* @license GPL-2.0-or-later
* @author Marius Hoch
*/
class Scribunto_LuaWikibaseStatsTest extends Scribunto_LuaWikibaseLibraryTestCase {
class WikibaseStatsTest extends WikibaseLibraryTestCase {

/** @var bool */
private $oldTrackLuaFunctionCallsPerWiki;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function testRenderLinkUsageWithinNestedTemplate() {
* well as calling `resetOutput`. `resetOutput` is called every time a new parse
* begins.
*
* What this means for the `Scribunto_LuaWikibaseEntityLibrary` is that it incorrectly
* What this means for the `WikibaseEntityLibrary` is that it incorrectly
* retains a reference to an old `ParserOutput` when two parses are consecutively in
* the context of the same page.
*/
Expand Down
10 changes: 10 additions & 0 deletions extension-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,16 @@
"Tests\\Integration\\Wikibase\\InternalSerialization\\": "lib/packages/wikibase/internal-serialization/tests/integration/",
"Wikibase\\DataAccess\\Tests\\": "data-access/tests/phpunit/"
},
"AutoloadClasses": {
"Wikibase\\Client\\DataAccess\\Scribunto\\WikibaseEntityLibrary": "client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php",
"Wikibase\\Client\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseEntityLibrary": "client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php",
"Wikibase\\Client\\DataAccess\\Scribunto\\WikibaseLibrary": "client/includes/DataAccess/Scribunto/WikibaseLibrary.php",
"Wikibase\\Client\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseLibrary": "client/includes/DataAccess/Scribunto/WikibaseLibrary.php"
},
"TestAutoloadClasses": {
"Wikibase\\Client\\Tests\\Integration\\DataAccess\\Scribunto\\WikibaseLibraryTestCase": "client/tests/phpunit/integration/includes/DataAccess/Scribunto/WikibaseLibraryTestCase.php",
"Wikibase\\Client\\Tests\\Integration\\DataAccess\\Scribunto\\Scribunto_LuaWikibaseLibraryTestCase": "client/tests/phpunit/integration/includes/DataAccess/Scribunto/WikibaseLibraryTestCase.php"
},
"JobClasses": {
"wikibase-addUsagesForPage": "\\Wikibase\\Client\\Store\\AddUsagesForPageJob",
"EntityChangeNotification": "\\Wikibase\\Client\\EntityChangeNotificationJob::newFromGlobalState",
Expand Down

0 comments on commit 3f84973

Please sign in to comment.