mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Use $this->getServiceContainer() in tests
Change-Id: I80a915e773a087a1fa663e0eebe9f0bab9be6d03
This commit is contained in:
parent
805f691188
commit
53d8aaa04a
|
@ -5,7 +5,6 @@ declare( strict_types = 1 );
|
||||||
namespace Cite\Tests\Integration;
|
namespace Cite\Tests\Integration;
|
||||||
|
|
||||||
use ExtensionRegistry;
|
use ExtensionRegistry;
|
||||||
use MediaWiki\MediaWikiServices;
|
|
||||||
use Wikimedia\ObjectFactory\ObjectFactory;
|
use Wikimedia\ObjectFactory\ObjectFactory;
|
||||||
use Wikimedia\Parsoid\Core\SelserData;
|
use Wikimedia\Parsoid\Core\SelserData;
|
||||||
use Wikimedia\Parsoid\DOM\Element;
|
use Wikimedia\Parsoid\DOM\Element;
|
||||||
|
@ -31,9 +30,20 @@ class CiteParsoidTest extends \MediaWikiIntegrationTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSiteConfig( $options ) {
|
private function getSiteConfig( $options ) {
|
||||||
$siteConfig = new class( $options ) extends MockSiteConfig {
|
$objectFactory = $this->getServiceContainer()->getObjectFactory();
|
||||||
|
$siteConfig = new class( $options, $objectFactory ) extends MockSiteConfig {
|
||||||
|
private ObjectFactory $objectFactory;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
array $opts,
|
||||||
|
ObjectFactory $objectFactory
|
||||||
|
) {
|
||||||
|
parent::__construct( $opts );
|
||||||
|
$this->objectFactory = $objectFactory;
|
||||||
|
}
|
||||||
|
|
||||||
public function getObjectFactory(): ObjectFactory {
|
public function getObjectFactory(): ObjectFactory {
|
||||||
return MediaWikiServices::getInstance()->getObjectFactory();
|
return $this->objectFactory;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Ensure that the Cite module is registered!
|
// Ensure that the Cite module is registered!
|
||||||
|
|
Loading…
Reference in a new issue