wiki.techinc.nl/tests/phpunit/unit/includes/parser/ParserFactoryTest.php
Aryeh Gregor 8ec24b607a Introduce MovePageFactory
This will help make MovePage more testable.

In the course of abstracting the logic out of ParserFactoryTest to
FactoryArgTestTrait so it could be used in MovePageFactoryTest, I made
them all unit tests instead of integration. This required some
modification to the Parser constructor so that it didn't access
MediaWikiServices unnecessarily.

Change-Id: Idaa1633f32dfedfa37516bb9180cfcfbe7ca31aa
2019-08-19 20:25:31 +03:00

32 lines
699 B
PHP

<?php
/**
* @covers ParserFactory
*/
class ParserFactoryTest extends MediaWikiUnitTestCase {
use FactoryArgTestTrait;
protected static function getFactoryClass() {
return ParserFactory::class;
}
protected static function getInstanceClass() {
return Parser::class;
}
protected static function getFactoryMethodName() {
return 'create';
}
protected static function getExtraClassArgCount() {
// The parser factory itself is passed to the parser
return 1;
}
protected function getOverriddenMockValueForParam( ReflectionParameter $param ) {
if ( $param->getPosition() === 0 ) {
return [ $this->createMock( MediaWiki\Config\ServiceOptions::class ) ];
}
return [];
}
}