| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Import; |
| 4 |
|
| 5 |
use FactoryArgTestTrait; |
| 6 |
use ImportSource; |
| 7 |
use MediaWikiUnitTestCase; |
| 8 |
use ReflectionParameter; |
| 9 |
use WikiImporter; |
| 10 |
use WikiImporterFactory; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
class WikiImporterFactoryTest extends MediaWikiUnitTestCase { |
| 16 |
use FactoryArgTestTrait; |
| 17 |
|
| 18 |
protected static function getFactoryClass() { |
| 19 |
return WikiImporterFactory::class; |
| 20 |
} |
| 21 |
|
| 22 |
protected static function getInstanceClass() { |
| 23 |
return WikiImporter::class; |
| 24 |
} |
| 25 |
|
| 26 |
protected static function getExtraClassArgCount() { |
| 27 |
return 2; |
| 28 |
} |
| 29 |
|
| 30 |
protected function getFactoryMethodName() { |
| 31 |
return 'getWikiImporter'; |
| 32 |
} |
| 33 |
|
| 34 |
protected function getOverriddenMockValueForParam( ReflectionParameter $param ) { |
| 35 |
if ( $param->getType()->getName() !== ImportSource::class ) { |
| 36 |
return []; |
| 37 |
} |
| 38 |
|
| 39 |
$importSource = $this->createMock( ImportSource::class ); |
| 40 |
$importSource->method( 'atEnd' )->willReturn( true ); |
| 41 |
return [ $importSource ]; |
| 42 |
} |
| 43 |
} |