X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fresourceloader%2FResourceLoaderImageModuleTest.php;h=0015486bb69b130db81386caadea41a1f9894214;hb=525bfbc8df855aa12e01868d92532cd64482dc7d;hp=aeb82d14ff3c6f9136b22591063c5e8d9c428703;hpb=fc7d715b4b5adedd0ae3e9e6f969c89e19d460eb;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php index aeb82d14ff..0015486bb6 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php @@ -1,5 +1,7 @@ assertInstanceOf( ResourceLoaderImage::class, $context->getImageObj() ); } + + public static function providerGetStyleDeclarations() { + return [ + [ + false, +<<getResourceLoaderContext(); + $image = $this->getImageMock( $context, $dataUriReturnValue ); + + $styles = $module->getStyleDeclarations( + $context, + $image, + 'load.php' + ); + + $this->assertEquals( $expected, $styles ); + } + + private function getImageMock( ResourceLoaderContext $context, $dataUriReturnValue ) { + $image = $this->getMockBuilder( 'ResourceLoaderImage' ) + ->disableOriginalConstructor() + ->getMock(); + $image->method( 'getDataUri' ) + ->will( $this->returnValue( $dataUriReturnValue ) ); + $image->expects( $this->any() ) + ->method( 'getUrl' ) + ->will( $this->returnValueMap( [ + [ $context, 'load.php', null, 'original', 'original.svg' ], + [ $context, 'load.php', null, 'rasterized', 'rasterized.png' ], + ] ) ); + + return $image; + } } class ResourceLoaderImageModuleTestable extends ResourceLoaderImageModule {