class BitmapScalingTest extends MediaWikiTestCase {
function setUp() {
- global $wgMaxImageArea;
+ global $wgMaxImageArea, $wgCustomConvertCommand;
$this->oldMaxImageArea = $wgMaxImageArea;
+ $this->oldCustomConvertCommand = $wgCustomConvertCommand;
$wgMaxImageArea = 1.25e7; // 3500x3500
+ $wgCustomConvertCommand = 'dummy'; // Set so that we don't get client side rendering
}
function tearDown() {
- global $wgMaxImageArea;
+ global $wgMaxImageArea, $wgCustomConvertCommand;
$wgMaxImageArea = $this->oldMaxImageArea;
+ $wgCustomConvertCommand = $this->oldCustomConvertCommand;
}
/**
* @dataProvider provideNormaliseParams
$file = new FakeDimensionFile( array( 4000, 4000 ) );
$handler = new BitmapHandler;
$params = array( 'width' => '3700' ); // Still bigger than max size.
- $this->assertFalse( $handler->normaliseParams( $file, $params ) );
+ $this->assertEquals( 'TransformParameterError',
+ get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) );
}
function testTooBigMustRenderImage() {
$file = new FakeDimensionFile( array( 4000, 4000 ) );
$file->mustRender = true;
$handler = new BitmapHandler;
$params = array( 'width' => '5000' ); // Still bigger than max size.
- $this->assertFalse( $handler->normaliseParams( $file, $params ) );
+ $this->assertEquals( 'TransformParameterError',
+ get_class( $handler->doTransform( $file, 'dummy path', '', $params ) ) );
}
}
public $mustRender = false;
public function __construct( $dimensions ) {
- parent::__construct( Title::makeTitle( NS_FILE, 'Test' ), null );
+ parent::__construct( Title::makeTitle( NS_FILE, 'Test' ),
+ new NullRepo( null ) );
$this->dimensions = $dimensions;
}
public function mustRender() {
return $this->mustRender;
}
+ public function getPath() {
+ return '';
+ }
}