summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/media/BitmapScalingTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /tests/phpunit/includes/media/BitmapScalingTest.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'tests/phpunit/includes/media/BitmapScalingTest.php')
-rw-r--r--tests/phpunit/includes/media/BitmapScalingTest.php47
1 files changed, 15 insertions, 32 deletions
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 '';
- }
-}