rename getAdjustedImageSize to getImageSizesForThumbnailer

This commit is contained in:
dianafa 2015-12-11 12:02:00 +01:00
parent cc54d4478d
commit 33af8b75e9
2 changed files with 7 additions and 7 deletions

View file

@ -203,7 +203,7 @@ class PortableInfoboxRenderServiceHelper {
$file = \WikiaFileHelper::getFileFromTitle( $title );
if ( $file ) {
$size = $this->getAdjustedImageSize( $file );
$size = $this->getImageSizesForThumbnailer( $file );
$thumb = $file->transform( $size );
if ( !is_null( $thumb ) && !$thumb->isError() ) {
@ -225,7 +225,7 @@ class PortableInfoboxRenderServiceHelper {
* @param $image
* @return array width and height
*/
public function getAdjustedImageSize( $image ) {
public function getImageSizesForThumbnailer( $image ) {
global $wgPortableInfoboxCustomImageWidth;
if ( $this->isWikiaMobile() ) {

View file

@ -389,7 +389,7 @@ class PortableInfoboxRenderServiceHelperTest extends WikiaBaseTest {
}
/**
* @desc test getAdjustedImageSize function. It should return the sizes we pass to transform function,
* @desc test getImageSizesForThumbnailer function. It should return the sizes we pass to transform function,
* not the sizes we want image to have. transform adjusts the correct sizes,
* that is creates thumbnail with sizes not bigger than passed, keeping the original aspect ratio.
*
@ -398,9 +398,9 @@ class PortableInfoboxRenderServiceHelperTest extends WikiaBaseTest {
* @param $wgPortableInfoboxCustomImageWidth
* @param $result
* @param $description
* @dataProvider testGetAdjustedImageSizeDataProvider
* @dataProvider testGetImageSizesForThumbnailerDataProvider
*/
public function testGetAdjustedImageSize( $mockParams, $isWikiaMobile, $wgPortableInfoboxCustomImageWidth, $result, $description ) {
public function testGetImageSizesForThumbnailer( $mockParams, $isWikiaMobile, $wgPortableInfoboxCustomImageWidth, $result, $description ) {
$this->mockGlobalVariable('wgPortableInfoboxCustomImageWidth', $wgPortableInfoboxCustomImageWidth);
$mock = $this->getMockBuilder( 'Wikia\PortableInfobox\Helpers\PortableInfoboxRenderServiceHelper' )
->setMethods( [ 'isWikiaMobile' ] )
@ -411,12 +411,12 @@ class PortableInfoboxRenderServiceHelperTest extends WikiaBaseTest {
$this->assertEquals(
$result,
$mock->getAdjustedImageSize( $file ),
$mock->getImageSizesForThumbnailer( $file ),
$description
);
}
public function testGetAdjustedImageSizeDataProvider() {
public function testGetImageSizesForThumbnailerDataProvider() {
return [
[
'mockParams' => [