Follow-up r99911: fix tests
[lhc/web/wiklou.git] / tests / phpunit / includes / media / BitmapScalingTest.php
index 5bcd323..39fdb81 100644 (file)
@@ -3,13 +3,16 @@
 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
@@ -105,14 +108,16 @@ class BitmapScalingTest extends MediaWikiTestCase {
                $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 ) ) );
        }
 }
 
@@ -120,7 +125,8 @@ class FakeDimensionFile extends File {
        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;
        }
@@ -133,4 +139,7 @@ class FakeDimensionFile extends File {
        public function mustRender() {
                return $this->mustRender;
        }
+       public function getPath() {
+               return '';
+       }
 }