Reformat function chains in FileTest.php
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 18 Jul 2014 22:56:35 +0000 (00:56 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 20 Jul 2014 20:06:35 +0000 (20:06 +0000)
This makes the mock code more readable.
Also break a long line phpcs mentioned.

Change-Id: I6de5f05e5ab3fb18bd15518409334d39beba71cb

tests/phpunit/includes/filerepo/file/FileTest.php

index 9af35fb..ffa9876 100644 (file)
@@ -42,8 +42,9 @@ class FileTest extends MediaWikiMediaTestCase {
                        ->setMethods( array( 'getWidth' ) )
                        ->getMockForAbstractClass();
 
-               $fileMock->expects( $this->any() )->method( 'getWidth' )->will(
-                       $this->returnValue( $data['width'] ) );
+               $fileMock->expects( $this->any() )
+                       ->method( 'getWidth' )
+                       ->will( $this->returnValue( $data['width'] ) );
 
                $this->assertEquals(
                        $data['expectedBucket'],
@@ -146,29 +147,35 @@ class FileTest extends MediaWikiMediaTestCase {
 
                $fsFile = new FSFile( 'fsFilePath' );
 
-               $repoMock->expects( $this->any() )->method( 'fileExists' )->will(
-                       $this->returnValue( true ) );
+               $repoMock->expects( $this->any() )
+                       ->method( 'fileExists' )
+                       ->will( $this->returnValue( true ) );
 
-               $repoMock->expects( $this->any() )->method( 'getLocalReference' )->will(
-                       $this->returnValue( $fsFile ) );
+               $repoMock->expects( $this->any() )
+                       ->method( 'getLocalReference' )
+                       ->will( $this->returnValue( $fsFile ) );
 
                $handlerMock = $this->getMock( 'BitmapHandler', array( 'supportsBucketing' ) );
-               $handlerMock->expects( $this->any() )->method( 'supportsBucketing' )->will(
-                       $this->returnValue( $data['supportsBucketing'] ) );
+               $handlerMock->expects( $this->any() )
+                       ->method( 'supportsBucketing' )
+                       ->will( $this->returnValue( $data['supportsBucketing'] ) );
 
                $fileMock = $this->getMockBuilder( 'File' )
                        ->setConstructorArgs( array( 'fileMock', $repoMock ) )
                        ->setMethods( array( 'getThumbnailBucket', 'getLocalRefPath', 'getHandler' ) )
                        ->getMockForAbstractClass();
 
-               $fileMock->expects( $this->any() )->method( 'getThumbnailBucket' )->will(
-                       $this->returnValue( $data['thumbnailBucket'] ) );
+               $fileMock->expects( $this->any() )
+                       ->method( 'getThumbnailBucket' )
+                       ->will( $this->returnValue( $data['thumbnailBucket'] ) );
 
-               $fileMock->expects( $this->any() )->method( 'getLocalRefPath' )->will(
-                       $this->returnValue( 'localRefPath' ) );
+               $fileMock->expects( $this->any() )
+                       ->method( 'getLocalRefPath' )
+                       ->will( $this->returnValue( 'localRefPath' ) );
 
-               $fileMock->expects( $this->any() )->method( 'getHandler' )->will(
-                       $this->returnValue( $handlerMock ) );
+               $fileMock->expects( $this->any() )
+                       ->method( 'getHandler' )
+                       ->will( $this->returnValue( $handlerMock ) );
 
                $reflection = new ReflectionClass( $fileMock );
                $reflection_property = $reflection->getProperty( 'handler' );
@@ -250,15 +257,18 @@ class FileTest extends MediaWikiMediaTestCase {
 
                $fileMock = $this->getMockBuilder( 'File' )
                        ->setConstructorArgs( array( 'fileMock', $repoMock ) )
-                       ->setMethods( array( 'getWidth', 'getBucketThumbPath', 'makeTransformTmpFile', 'generateAndSaveThumb', 'getHandler' ) )
+                       ->setMethods( array( 'getWidth', 'getBucketThumbPath', 'makeTransformTmpFile',
+                               'generateAndSaveThumb', 'getHandler' ) )
                        ->getMockForAbstractClass();
 
                $handlerMock = $this->getMock( 'JpegHandler', array( 'supportsBucketing' ) );
-               $handlerMock->expects( $this->any() )->method( 'supportsBucketing' )->will(
-                       $this->returnValue( true ) );
+               $handlerMock->expects( $this->any() )
+                       ->method( 'supportsBucketing' )
+                       ->will( $this->returnValue( true ) );
 
-               $fileMock->expects( $this->any() )->method( 'getHandler' )->will(
-                       $this->returnValue( $handlerMock ) );
+               $fileMock->expects( $this->any() )
+                       ->method( 'getHandler' )
+                       ->will( $this->returnValue( $handlerMock ) );
 
                $reflectionMethod = new ReflectionMethod( 'File', 'generateBucketsIfNeeded' );
                $reflectionMethod->setAccessible( true );