Make lines short to pass phpcs in 3 files under tests/phpunit/includes/
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Wed, 30 Sep 2015 08:15:32 +0000 (11:15 +0300)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 1 Oct 2015 19:00:40 +0000 (19:00 +0000)
Bug: T102614
Change-Id: I8f3d570fb6e9866d4376f42d4efa05f9c5e7f14d

tests/phpunit/includes/debug/logger/monolog/AvroFormatterTest.php
tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php
tests/phpunit/includes/utils/BatchRowUpdateTest.php

index 44242ed..b0df616 100644 (file)
@@ -34,7 +34,10 @@ class AvroFormatterTest extends MediaWikiTestCase {
 
        public function testSchemaNotAvailable() {
                $formatter = new AvroFormatter( array() );
-               $this->setExpectedException( 'PHPUnit_Framework_Error_Notice', "The schema for channel 'marty' is not available" );
+               $this->setExpectedException(
+                       'PHPUnit_Framework_Error_Notice',
+                       "The schema for channel 'marty' is not available"
+               );
                $formatter->format( array( 'channel' => 'marty' ) );
        }
 
index 3f08fd2..c839bc4 100644 (file)
@@ -48,10 +48,16 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase {
                                'backend' => $backend
                        ) ) );
 
-               $repoMock->expects( $this->any() )->method( 'getMasterDB' )->will( $this->returnValue( $dbMock ) );
+               $repoMock
+                       ->expects( $this->any() )
+                       ->method( 'getMasterDB' )
+                       ->will( $this->returnValue( $dbMock ) );
 
                $this->migratorMock = $this->getMock( 'MigrateFileRepoLayout', array( 'getRepo' ) );
-               $this->migratorMock->expects( $this->any() )->method( 'getRepo' )->will( $this->returnValue( $repoMock ) );
+               $this->migratorMock
+                       ->expects( $this->any() )
+                       ->method( 'getRepo' )
+                       ->will( $this->returnValue( $repoMock ) );
 
                $this->tmpFilepath = TempFSFile::factory( 'migratefilelayout-test-', 'png' )->getPath();
 
@@ -59,7 +65,12 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase {
 
                $hashPath = $repoMock->getHashPath( $filename );
 
-               $status = $repoMock->store( $this->tmpFilepath, 'public', $hashPath . $filename, FileRepo::OVERWRITE );
+               $status = $repoMock->store(
+                       $this->tmpFilepath,
+                       'public',
+                       $hashPath . $filename,
+                       FileRepo::OVERWRITE
+               );
        }
 
        protected function deleteFilesRecursively( $directory ) {
@@ -85,7 +96,10 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase {
        }
 
        public function testMigration() {
-               $this->migratorMock->loadParamsAndArgs( null, array( 'oldlayout' => 'name', 'newlayout' => 'sha1' ) );
+               $this->migratorMock->loadParamsAndArgs(
+                       null,
+                       array( 'oldlayout' => 'name', 'newlayout' => 'sha1' )
+               );
 
                ob_start();
 
@@ -105,10 +119,18 @@ class MigrateFileRepoLayoutTest extends MediaWikiTestCase {
                        . '/'
                        . $sha1;
 
-               $this->assertEquals( file_get_contents( $expectedOriginalFilepath ), $this->text, 'New sha1 file should be exist and have the right contents' );
+               $this->assertEquals(
+                       file_get_contents( $expectedOriginalFilepath ),
+                       $this->text,
+                       'New sha1 file should be exist and have the right contents'
+               );
 
                $expectedPublicFilepath = $this->tmpPrefix . '-public/f/f8/Foo.png';
 
-               $this->assertEquals( file_get_contents( $expectedPublicFilepath ), $this->text, 'Existing name file should still and have the right contents' );
+               $this->assertEquals(
+                       file_get_contents( $expectedPublicFilepath ),
+                       $this->text,
+                       'Existing name file should still and have the right contents'
+               );
        }
 }
index 4684658..082ac82 100644 (file)
@@ -123,11 +123,14 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
        /**
         * @dataProvider provider_readerSetFetchColumns
         */
-       public function testReaderSetFetchColumns( $message, array $columns, array $primaryKeys, array $fetchColumns ) {
+       public function testReaderSetFetchColumns(
+               $message, array $columns, array $primaryKeys, array $fetchColumns
+       ) {
                $db = $this->mockDb();
                $db->expects( $this->once() )
                        ->method( 'select' )
-                       ->with( 'some_table', $columns ) // only testing second parameter of DatabaseBase::select
+                       // only testing second parameter of DatabaseBase::select
+                       ->with( 'some_table', $columns )
                        ->will( $this->returnValue( new ArrayIterator( array() ) ) );
 
                $reader = new BatchRowIterator( $db, 'some_table', $primaryKeys, 22 );
@@ -148,7 +151,8 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
                        ),
 
                        array(
-                               'With multiple primary keys the first conditions must use >= and the final condition must use >',
+                               'With multiple primary keys the first conditions ' .
+                                       'must use >= and the final condition must use >',
                                // Expected second iteration
                                array( "( id_field = '3' AND foo > '103' ) OR ( id_field > '3' )" ),
                                // Primary key(s)
@@ -164,7 +168,9 @@ class BatchRowUpdateTest extends MediaWikiTestCase {
         *
         * @dataProvider provider_readerSelectConditions
         */
-       public function testReaderSelectConditionsMultiplePrimaryKeys( $message, $expectedSecondIteration, $primaryKeys, $batchSize = 3 ) {
+       public function testReaderSelectConditionsMultiplePrimaryKeys(
+               $message, $expectedSecondIteration, $primaryKeys, $batchSize = 3
+       ) {
                $results = $this->genSelectResult( $batchSize, $batchSize * 3, function() {
                        static $i = 0, $j = 100, $k = 1000;
                        return array( 'id_field' => ++$i, 'foo' => ++$j, 'bar' => ++$k );