wiki.techinc.nl/tests/phpunit/unit/includes/page/PageStoreFactoryTest.php
Umherirrender 167fb2a979 unit tests: Use MainConfigNames constant to refer configs
When creating ServiceOptions objects or fake HashConfigs use the
constant to refer the config name

Change-Id: I59a29f25b76e896c07e82156c6cc4494f98e64cc
2022-08-17 22:33:58 +02:00

45 lines
1.3 KiB
PHP

<?php
namespace MediaWiki\Tests\Page;
use LinkCache;
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageStore;
use MediaWiki\Page\PageStoreFactory;
use MediaWikiUnitTestCase;
use NamespaceInfo;
use TitleParser;
use Wikimedia\Rdbms\LBFactory;
use Wikimedia\Rdbms\LoadBalancer;
/**
* @covers \MediaWiki\Page\PageStoreFactory
*/
class PageStoreFactoryTest extends MediaWikiUnitTestCase {
public function testGetPageStore() {
$options = new ServiceOptions( PageStoreFactory::CONSTRUCTOR_OPTIONS, [
MainConfigNames::LanguageCode => 'fi',
MainConfigNames::PageLanguageUseDB => true,
] );
$lb = $this->createNoOpMock( LoadBalancer::class );
$lbFactory = $this->createNoOpMock( LBFactory::class, [ 'getMainLB' ] );
$lbFactory->method( 'getMainLB' )->willReturn( $lb );
$factory = new PageStoreFactory(
$options,
$lbFactory,
$this->createNoOpMock( NamespaceInfo::class ),
$this->createNoOpMock( TitleParser::class ),
$this->createNoOpMock( LinkCache::class ),
$this->createNoOpMock( StatsdDataFactoryInterface::class )
);
// Just check that nothing explodes.
$this->assertInstanceOf( PageStore::class, $factory->getPageStore() );
}
}