diff --git a/.phpcs.xml b/.phpcs.xml index 7a67425..5c5f51b 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,11 +1,10 @@ - - - - - + . + + maintenance/initImageData.php + vendor diff --git a/tests/phpunit/ApiQueryPageImagesProxyMock.php b/tests/phpunit/ApiQueryPageImagesProxyMock.php new file mode 100644 index 0000000..2d7d27c --- /dev/null +++ b/tests/phpunit/ApiQueryPageImagesProxyMock.php @@ -0,0 +1,29 @@ +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 ); + } +} diff --git a/tests/phpunit/ApiQueryPageImagesTest.php b/tests/phpunit/ApiQueryPageImagesTest.php index 9456978..bf7ec8f 100644 --- a/tests/phpunit/ApiQueryPageImagesTest.php +++ b/tests/phpunit/ApiQueryPageImagesTest.php @@ -2,33 +2,14 @@ namespace PageImages\Tests; -use ApiPageSet; +require_once 'ApiQueryPageImagesProxyMock.php'; + use ApiQueryPageImages; use PageImages; use Title; use Wikimedia\Rdbms\FakeResultWrapper; 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 * @@ -111,7 +92,7 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase { $pageSet->expects( $this->any() ) ->method( 'getMissingTitlesByNamespace' ) ->will( $this->returnValue( $missingTitlesByNamespace ) ); - $queryPageImages = new ApiQueryPageImagesProxy( $pageSet ); + $queryPageImages = new ApiQueryPageImagesProxyMock( $pageSet ); $this->assertEquals( $expected, $queryPageImages->getTitles() ); } @@ -306,7 +287,7 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase { * @param string $expected */ public function testGetPropName( $license, $expected ) { - $this->assertEquals( $expected, ApiQueryPageImagesProxy::getPropNames( $license ) ); + $this->assertEquals( $expected, ApiQueryPageImagesProxyMock::getPropNames( $license ) ); } public function provideGetPropName() {