mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-24 00:13:27 +00:00
Merge "Use streamlined upstream createMock in PHPUnit tests"
This commit is contained in:
commit
87e257dd27
|
@ -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