2021-03-17 22:13:35 +00:00
|
|
|
<?php
|
|
|
|
|
namespace MediaWiki\Tests\Page;
|
|
|
|
|
|
|
|
|
|
use LoadBalancer;
|
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
|
|
|
use MediaWiki\Page\PageStore;
|
|
|
|
|
use MediaWiki\Page\PageStoreFactory;
|
|
|
|
|
use MediaWikiUnitTestCase;
|
|
|
|
|
use NamespaceInfo;
|
2021-05-04 20:45:30 +00:00
|
|
|
use TitleParser;
|
2021-03-17 22:13:35 +00:00
|
|
|
use Wikimedia\Rdbms\LBFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers \MediaWiki\Page\PageStoreFactory
|
|
|
|
|
*/
|
|
|
|
|
class PageStoreFactoryTest extends MediaWikiUnitTestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetPageStore() {
|
|
|
|
|
$options = new ServiceOptions( PageStoreFactory::CONSTRUCTOR_OPTIONS, [
|
|
|
|
|
'LanguageCode' => 'fi',
|
|
|
|
|
'PageLanguageUseDB' => true,
|
|
|
|
|
] );
|
|
|
|
|
|
|
|
|
|
$lb = $this->createNoOpMock( LoadBalancer::class );
|
|
|
|
|
|
|
|
|
|
$lbFactory = $this->createNoOpMock( LBFactory::class, [ 'getMainLB' ] );
|
|
|
|
|
$lbFactory->method( 'getMainLB' )->willReturn( $lb );
|
|
|
|
|
|
|
|
|
|
$factory = new PageStoreFactory(
|
|
|
|
|
$options,
|
|
|
|
|
$lbFactory,
|
2021-05-04 20:45:30 +00:00
|
|
|
$this->createNoOpMock( NamespaceInfo::class ),
|
|
|
|
|
$this->createNoOpMock( TitleParser::class )
|
2021-03-17 22:13:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Just check that nothing explodes.
|
|
|
|
|
$this->assertInstanceOf( PageStore::class, $factory->getPageStore() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|