Conditionally skip tests that depend on Wikibase

While investigating the dependency between
Math and Wikibase, it turned out there was
a hard dependency in the test code.

This change makes the availability of the Wikibase
Extension optional and conditionally skips tests.

Bug: T362027
Change-Id: I9401d7d4a3277b6923dcd81f411ac5a08f1242d2
(cherry picked from commit 0f11a20d8f)
This commit is contained in:
Moritz Schubotz (physikerwelt) 2024-04-08 14:45:40 +02:00 committed by Reedy
parent a8e8717bb9
commit 354393b670

View file

@ -3,6 +3,7 @@
namespace MediaWiki\Extension\Math\Tests;
use DataValues\StringValue;
use ExtensionRegistry;
use Language;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Extension\Math\MathFormatter;
@ -50,6 +51,13 @@ class MathWikibaseConnectorTestFactory extends MediaWikiUnitTestCase {
]
];
public static function setUpBeforeClass(): void {
if ( !ExtensionRegistry::getInstance()->isLoaded( 'WikibaseClient' ) ) {
self::markTestSkipped( 'WikibaseClient is not installed. Skipping tests.' );
}
parent::setUpBeforeClass();
}
public function getWikibaseConnectorWithExistingItems(
EntityRevision $entityRevision,
bool $storageExceptionOnQ3 = false,