From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- tests/phpunit/includes/media/BitmapScalingTest.php | 47 +++++++--------------- 1 file changed, 15 insertions(+), 32 deletions(-) (limited to 'tests/phpunit/includes/media/BitmapScalingTest.php') diff --git a/tests/phpunit/includes/media/BitmapScalingTest.php b/tests/phpunit/includes/media/BitmapScalingTest.php index 3de60b73..9395b660 100644 --- a/tests/phpunit/includes/media/BitmapScalingTest.php +++ b/tests/phpunit/includes/media/BitmapScalingTest.php @@ -13,8 +13,9 @@ class BitmapScalingTest extends MediaWikiTestCase { /** * @dataProvider provideNormaliseParams + * @covers BitmapHandler::normaliseParams */ - function testNormaliseParams( $fileDimensions, $expectedParams, $params, $msg ) { + public function testNormaliseParams( $fileDimensions, $expectedParams, $params, $msg ) { $file = new FakeDimensionFile( $fileDimensions ); $handler = new BitmapHandler; $valid = $handler->normaliseParams( $file, $params ); @@ -22,7 +23,7 @@ class BitmapScalingTest extends MediaWikiTestCase { $this->assertEquals( $expectedParams, $params, $msg ); } - function provideNormaliseParams() { + public static function provideNormaliseParams() { return array( /* Regular resize operations */ array( @@ -102,7 +103,10 @@ class BitmapScalingTest extends MediaWikiTestCase { ); } - function testTooBigImage() { + /** + * @covers BitmapHandler::doTransform + */ + public function testTooBigImage() { $file = new FakeDimensionFile( array( 4000, 4000 ) ); $handler = new BitmapHandler; $params = array( 'width' => '3700' ); // Still bigger than max size. @@ -110,7 +114,10 @@ class BitmapScalingTest extends MediaWikiTestCase { get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) ); } - function testTooBigMustRenderImage() { + /** + * @covers BitmapHandler::doTransform + */ + public function testTooBigMustRenderImage() { $file = new FakeDimensionFile( array( 4000, 4000 ) ); $file->mustRender = true; $handler = new BitmapHandler; @@ -119,36 +126,12 @@ class BitmapScalingTest extends MediaWikiTestCase { get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) ); } - function testImageArea() { + /** + * @covers BitmapHandler::getImageArea + */ + public function testImageArea() { $file = new FakeDimensionFile( array( 7, 9 ) ); $handler = new BitmapHandler; $this->assertEquals( 63, $handler->getImageArea( $file ) ); } } - -class FakeDimensionFile extends File { - public $mustRender = false; - - public function __construct( $dimensions ) { - parent::__construct( Title::makeTitle( NS_FILE, 'Test' ), - new NullRepo( null ) ); - - $this->dimensions = $dimensions; - } - - public function getWidth( $page = 1 ) { - return $this->dimensions[0]; - } - - public function getHeight( $page = 1 ) { - return $this->dimensions[1]; - } - - public function mustRender() { - return $this->mustRender; - } - - public function getPath() { - return ''; - } -} -- cgit v1.2.2