mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-27 09:42:39 +00:00
Use streamlined upstream createMock in PHPUnit tests
Change-Id: I3920819a97d05771f54687dab99ea9657371ac53
This commit is contained in:
parent
2277abbb00
commit
903e1428c1
|
@ -34,16 +34,12 @@ class ApiQueryPageImagesTest extends TestCase {
|
|||
$context->method( 'getConfig' )
|
||||
->willReturn( $config );
|
||||
|
||||
$main = $this->getMockBuilder( \ApiMain::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$main = $this->createMock( \ApiMain::class );
|
||||
$main->expects( $this->once() )
|
||||
->method( 'getContext' )
|
||||
->willReturn( $context );
|
||||
|
||||
$query = $this->getMockBuilder( \ApiQuery::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$query = $this->createMock( \ApiQuery::class );
|
||||
$query->expects( $this->once() )
|
||||
->method( 'getMain' )
|
||||
->willReturn( $main );
|
||||
|
@ -84,9 +80,7 @@ class ApiQueryPageImagesTest extends TestCase {
|
|||
* @dataProvider provideGetTitles
|
||||
*/
|
||||
public function testGetTitles( $titles, $missingTitlesByNamespace, $expected ) {
|
||||
$pageSet = $this->getMockBuilder( \ApiPageSet::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$pageSet = $this->createMock( \ApiPageSet::class );
|
||||
$pageSet->method( 'getGoodTitles' )
|
||||
->willReturn( $titles );
|
||||
$pageSet->method( 'getMissingTitlesByNamespace' )
|
||||
|
|
|
@ -68,16 +68,12 @@ class ParserFileProcessingHookHandlersTest extends MediaWikiIntegrationTestCase
|
|||
* @return RepoGroup
|
||||
*/
|
||||
private function getRepoGroup() {
|
||||
$file = $this->getMockBuilder( File::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$file = $this->createMock( File::class );
|
||||
// ugly hack to avoid all the unmockable crap in FormatMetadata
|
||||
$file->method( 'isDeleted' )
|
||||
->willReturn( true );
|
||||
|
||||
$repoGroup = $this->getMockBuilder( RepoGroup::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$repoGroup = $this->createMock( RepoGroup::class );
|
||||
$repoGroup->method( 'findFile' )
|
||||
->willReturn( $file );
|
||||
|
||||
|
|
Loading…
Reference in a new issue