mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-13 18:36:59 +00:00
Fix remaining php sniffs
* Separate the ApiQueryPageImages mock into its own file Bug: T170583 Change-Id: I3db5de11618f952eb7974c456445eaa1d5e4e6a4
This commit is contained in:
parent
d29c0d6585
commit
fcc96696d5
|
@ -1,11 +1,10 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset>
|
<ruleset>
|
||||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
||||||
<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
|
|
||||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
|
||||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
|
|
||||||
</rule>
|
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
|
<rule ref="MediaWiki.Files.ClassMatchesFilename.WrongCase">
|
||||||
|
<exclude-pattern>maintenance/initImageData.php</exclude-pattern>
|
||||||
|
</rule>
|
||||||
<arg name="extensions" value="php,php5,inc" />
|
<arg name="extensions" value="php,php5,inc" />
|
||||||
<arg name="encoding" value="UTF-8" />
|
<arg name="encoding" value="UTF-8" />
|
||||||
<exclude-pattern>vendor</exclude-pattern>
|
<exclude-pattern>vendor</exclude-pattern>
|
||||||
|
|
29
tests/phpunit/ApiQueryPageImagesProxyMock.php
Normal file
29
tests/phpunit/ApiQueryPageImagesProxyMock.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PageImages\Tests;
|
||||||
|
|
||||||
|
use ApiPageSet;
|
||||||
|
use ApiQueryPageImages;
|
||||||
|
|
||||||
|
class ApiQueryPageImagesProxyMock extends ApiQueryPageImages {
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
public function __construct( ApiPageSet $pageSet ) {
|
||||||
|
$this->pageSet = $pageSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
public function getPageSet() {
|
||||||
|
return $this->pageSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
public function getTitles() {
|
||||||
|
return parent::getTitles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
public static function getPropNames( $license ) {
|
||||||
|
return parent::getPropNames( $license );
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,33 +2,14 @@
|
||||||
|
|
||||||
namespace PageImages\Tests;
|
namespace PageImages\Tests;
|
||||||
|
|
||||||
use ApiPageSet;
|
require_once 'ApiQueryPageImagesProxyMock.php';
|
||||||
|
|
||||||
use ApiQueryPageImages;
|
use ApiQueryPageImages;
|
||||||
use PageImages;
|
use PageImages;
|
||||||
use Title;
|
use Title;
|
||||||
use Wikimedia\Rdbms\FakeResultWrapper;
|
use Wikimedia\Rdbms\FakeResultWrapper;
|
||||||
use Wikimedia\TestingAccessWrapper;
|
use Wikimedia\TestingAccessWrapper;
|
||||||
|
|
||||||
class ApiQueryPageImagesProxy extends ApiQueryPageImages {
|
|
||||||
|
|
||||||
public function __construct( ApiPageSet $pageSet ) {
|
|
||||||
$this->pageSet = $pageSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPageSet() {
|
|
||||||
return $this->pageSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitles() {
|
|
||||||
return parent::getTitles();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** inheritdoc */
|
|
||||||
public static function getPropNames( $license ) {
|
|
||||||
return parent::getPropNames( $license );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ApiQueryPageImages
|
* @covers ApiQueryPageImages
|
||||||
*
|
*
|
||||||
|
@ -111,7 +92,7 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase {
|
||||||
$pageSet->expects( $this->any() )
|
$pageSet->expects( $this->any() )
|
||||||
->method( 'getMissingTitlesByNamespace' )
|
->method( 'getMissingTitlesByNamespace' )
|
||||||
->will( $this->returnValue( $missingTitlesByNamespace ) );
|
->will( $this->returnValue( $missingTitlesByNamespace ) );
|
||||||
$queryPageImages = new ApiQueryPageImagesProxy( $pageSet );
|
$queryPageImages = new ApiQueryPageImagesProxyMock( $pageSet );
|
||||||
|
|
||||||
$this->assertEquals( $expected, $queryPageImages->getTitles() );
|
$this->assertEquals( $expected, $queryPageImages->getTitles() );
|
||||||
}
|
}
|
||||||
|
@ -306,7 +287,7 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase {
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
*/
|
*/
|
||||||
public function testGetPropName( $license, $expected ) {
|
public function testGetPropName( $license, $expected ) {
|
||||||
$this->assertEquals( $expected, ApiQueryPageImagesProxy::getPropNames( $license ) );
|
$this->assertEquals( $expected, ApiQueryPageImagesProxyMock::getPropNames( $license ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideGetPropName() {
|
public function provideGetPropName() {
|
||||||
|
|
Loading…
Reference in a new issue