Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/224641

Change subject: Convert spaces to tabs in SqlDumpMetaInfomationRepoTest.php
......................................................................

Convert spaces to tabs in SqlDumpMetaInfomationRepoTest.php

Change-Id: Ifb53ea524800bd7521f5b2e856211e3116878cc6
---
M tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
1 file changed, 329 insertions(+), 324 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation
 refs/changes/41/224641/1

diff --git 
a/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php 
b/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
index 3af7f1a..df7a128 100755
--- a/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
+++ b/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
@@ -8,7 +8,6 @@
 use WikibaseQuality\ExternalValidation\DumpMetaInformation\DumpMetaInformation;
 use 
WikibaseQuality\ExternalValidation\DumpMetaInformation\SqlDumpMetaInformationRepo;
 
-
 /**
  * @covers 
WikibaseQuality\ExternalValidation\DumpMetaInformation\SqlDumpMetaInformationRepo
  *
@@ -23,281 +22,287 @@
  */
 class SqlDumpMetaInformationRepoTest extends \MediaWikiTestCase {
 
-    /**
-     * @var SqlDumpMetaInformationRepo
-     */
-    private $dumpMetaInformationRepo;
-
-    /**
-     * @var DumpMetaInformation[]
-     */
-    private $dumpMetaInformation;
-
-    public function __construct( $name = null, $data = array(), $dataName = 
null ) {
-        parent::__construct( $name, $data, $dataName );
-
-        // Create example dump meta information
-        $this->dumpMetaInformation = array(
-            'foo' => new DumpMetaInformation(
-                'foo',
-                new ItemId( 'Q1' ),
-                array( new PropertyId( 'P1' ) ),
-                '20150101000000',
-                'en',
-                'http://www.foo.bar',
-                42,
-                new ItemId( 'Q6938433' )
-            ),
-            'bar' => new DumpMetaInformation(
-                'bar',
-                new ItemId( 'Q2' ),
-                array( new PropertyId( 'P2' ) ),
-                '20200101121212',
-                'de',
-                'http://www.fu.bar',
-                4242,
-                new ItemId( 'Q6938433' )
-            ),
-            'baz' => new DumpMetaInformation(
-                'baz',
-                new ItemId( 'Q3' ),
-                array(
-                    new PropertyId( 'P2' ),
-                    new PropertyId( 'P3' )
-                ),
-                '20250101131313',
-                'de',
-                'http://www.fu.baz',
-                424242,
-                new ItemId( 'Q6938433' )
-            )
-        );
-    }
-
-    public function setUp() {
-        parent::setUp();
-
-        $this->tablesUsed[] = SqlDumpMetaInformationRepo::META_TABLE_NAME;
-        $this->tablesUsed[] = 
SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME;
-
-        $this->dumpMetaInformationRepo = new SqlDumpMetaInformationRepo( new 
BasicEntityIdParser() );
-    }
-
-    public function tearDown() {
-        unset( $this->dumpMetaInformationRepo );
-
-        parent::tearDown();
-    }
-
-    /**
-     * Adds temporary test data to database
-     *
-     * @throws \DBUnexpectedError
-     */
-    public function addDBData() {
-        $this->db->delete(
-            SqlDumpMetaInformationRepo::META_TABLE_NAME,
-            '*'
-        );
-        $this->db->delete(
-            SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME,
-            '*'
-        );
-
-        foreach ( $this->dumpMetaInformation as $dumpMetaInformation ) {
-            $this->db->insert(
-                SqlDumpMetaInformationRepo::META_TABLE_NAME,
-                array(
-                    'id' => $dumpMetaInformation->getDumpId(),
-                    'source_qid' => 
$dumpMetaInformation->getSourceItemId()->getSerialization(),
-                    'import_date' => $this->db->timestamp( 
$dumpMetaInformation->getImportDate() ),
-                    'language' => $dumpMetaInformation->getLanguageCode(),
-                    'source_url' => $dumpMetaInformation->getSourceUrl(),
-                    'size' => $dumpMetaInformation->getSize(),
-                    'license_qid' => $dumpMetaInformation->getLicenseItemId()
-                )
-            );
-            foreach ( $dumpMetaInformation->getIdentifierPropertyIds() as 
$propertyId ) {
-                $this->db->insert(
-                    
SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME,
-                    array(
-                        'dump_id' => $dumpMetaInformation->getDumpId(),
-                        'identifier_pid' => $propertyId->getSerialization()
-                    )
-                );
-            }
-        }
-    }
-
+       /**
+        * @var SqlDumpMetaInformationRepo
+        */
+       private $dumpMetaInformationRepo;
 
        /**
-     * @dataProvider getWithIdDataProvider
-     */
-    public function testGetWithId( $dumpId, $expectedDumpMetaInformation, 
$expectedException = null ) {
-        $this->setExpectedException( $expectedException );
+        * @var DumpMetaInformation[]
+        */
+       private $dumpMetaInformation;
 
-        $dumpMetaInformation = $this->dumpMetaInformationRepo->getWithId( 
$dumpId );
+       public function __construct( $name = null, $data = array(), $dataName = 
null ) {
+               parent::__construct( $name, $data, $dataName );
 
-        $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
-    }
+               // Create example dump meta information
+               $this->dumpMetaInformation = array(
+                       'foo' => new DumpMetaInformation(
+                               'foo',
+                               new ItemId( 'Q1' ),
+                               array( new PropertyId( 'P1' ) ),
+                               '20150101000000',
+                               'en',
+                               'http://www.foo.bar',
+                               42,
+                               new ItemId( 'Q6938433' )
+                       ),
+                       'bar' => new DumpMetaInformation(
+                               'bar',
+                               new ItemId( 'Q2' ),
+                               array( new PropertyId( 'P2' ) ),
+                               '20200101121212',
+                               'de',
+                               'http://www.fu.bar',
+                               4242,
+                               new ItemId( 'Q6938433' )
+                       ),
+                       'baz' => new DumpMetaInformation(
+                               'baz',
+                               new ItemId( 'Q3' ),
+                               array(
+                                       new PropertyId( 'P2' ),
+                                       new PropertyId( 'P3' )
+                               ),
+                               '20250101131313',
+                               'de',
+                               'http://www.fu.baz',
+                               424242,
+                               new ItemId( 'Q6938433' )
+                       )
+               );
+       }
 
-    /**
-     * @return array
-     */
-    public function getWithIdDataProvider() {
-        return array(
-            // Single id
-            array(
-                'foo',
-                $this->dumpMetaInformation['foo']
-            ),
-            array(
-                'bar',
-                $this->dumpMetaInformation['bar']
-            ),
-            array(
-                'baz',
-                $this->dumpMetaInformation['baz']
-            ),
-            // Non-existent id
-            array(
-                'foobar',
-                null
-            ),
-            // Invalid ids
-            array(
-                42,
-                null,
-                'InvalidArgumentException'
-            ),
-            array(
-                array( 'foo' ),
-                null,
-                'InvalidArgumentException'
-            ),
-            array(
-                null,
-                null,
-                'InvalidArgumentException'
-            )
-        );
-    }
+       public function setUp() {
+               parent::setUp();
 
+               $this->tablesUsed[] = 
SqlDumpMetaInformationRepo::META_TABLE_NAME;
+               $this->tablesUsed[] = 
SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME;
 
-    /**
-     * @dataProvider getWithIdsDataProvider
-     */
-    public function testGetWithIds( $dumpIds, $expectedDumpMetaInformation, 
$expectedException = null ) {
-        $this->setExpectedException( $expectedException );
+               $this->dumpMetaInformationRepo =
+                       new SqlDumpMetaInformationRepo( new 
BasicEntityIdParser() );
+       }
 
-        $dumpMetaInformation = $this->dumpMetaInformationRepo->getWithIds( 
$dumpIds );
+       public function tearDown() {
+               unset( $this->dumpMetaInformationRepo );
 
-        $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
-    }
+               parent::tearDown();
+       }
 
-    /**
-     * @return array
-     */
-    public function getWithIdsDataProvider() {
-        return array(
-            // Multiple ids
-            array(
-                array(
-                    'foo',
-                    'bar'
-                ),
-                array(
-                    'foo' => $this->dumpMetaInformation['foo'],
-                    'bar' => $this->dumpMetaInformation['bar']
-                )
-            ),
-            // Empty array of dump ids
-            array(
-                array(),
-                array()
-            ),
-            // Non-existent id
-            array(
-                array( 'foobar' ),
-                array()
-            ),
-            // Invalid ids
-            array(
-                array( 42 ),
-                null,
-                'InvalidArgumentException'
-            )
-        );
-    }
+       /**
+        * Adds temporary test data to database
+        *
+        * @throws \DBUnexpectedError
+        */
+       public function addDBData() {
+               $this->db->delete(
+                       SqlDumpMetaInformationRepo::META_TABLE_NAME,
+                       '*'
+               );
+               $this->db->delete(
+                       
SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME,
+                       '*'
+               );
 
-    public function testGetAllDumpMetaInformation() {
-        $dumpMetaInformation = $this->dumpMetaInformationRepo->getAll();
-        $expectedDumpMetaInformation = array(
-            'foo' => $this->dumpMetaInformation['foo'],
-            'bar' => $this->dumpMetaInformation['bar'],
-            'baz' => $this->dumpMetaInformation['baz']
-        );
+               foreach ( $this->dumpMetaInformation as $dumpMetaInformation ) {
+                       $this->db->insert(
+                               SqlDumpMetaInformationRepo::META_TABLE_NAME,
+                               array(
+                                       'id' => 
$dumpMetaInformation->getDumpId(),
+                                       'source_qid' => 
$dumpMetaInformation->getSourceItemId()->getSerialization(),
+                                       'import_date' => $this->db->timestamp( 
$dumpMetaInformation->getImportDate() ),
+                                       'language' => 
$dumpMetaInformation->getLanguageCode(),
+                                       'source_url' => 
$dumpMetaInformation->getSourceUrl(),
+                                       'size' => 
$dumpMetaInformation->getSize(),
+                                       'license_qid' => 
$dumpMetaInformation->getLicenseItemId()
+                               )
+                       );
+                       foreach ( 
$dumpMetaInformation->getIdentifierPropertyIds() as $propertyId ) {
+                               $this->db->insert(
+                                       
SqlDumpMetaInformationRepo::IDENTIFIER_PROPERTIES_TABLE_NAME,
+                                       array(
+                                               'dump_id' => 
$dumpMetaInformation->getDumpId(),
+                                               'identifier_pid' => 
$propertyId->getSerialization()
+                                       )
+                               );
+                       }
+               }
+       }
 
-        $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
-    }
+       /**
+        * @dataProvider getWithIdDataProvider
+        */
+       public function testGetWithId( $dumpId,
+               $expectedDumpMetaInformation,
+               $expectedException = null ) {
+               $this->setExpectedException( $expectedException );
 
-    /**
-     * @dataProvider getWithIdentifierPropertiesDataProvider
-     */
-    public function testGetWithIdentifierProperties( $identifierPropertyIds, 
$expectedDumpMetaInformation, $expectedException = null ) {
-        $this->setExpectedException( $expectedException );
+               $dumpMetaInformation = 
$this->dumpMetaInformationRepo->getWithId( $dumpId );
 
-        $dumpMetaInformation = 
$this->dumpMetaInformationRepo->getWithIdentifierProperties( 
$identifierPropertyIds );
+               $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
+       }
 
-        $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
-    }
+       /**
+        * @return array
+        */
+       public function getWithIdDataProvider() {
+               return array(
+                       // Single id
+                       array(
+                               'foo',
+                               $this->dumpMetaInformation['foo']
+                       ),
+                       array(
+                               'bar',
+                               $this->dumpMetaInformation['bar']
+                       ),
+                       array(
+                               'baz',
+                               $this->dumpMetaInformation['baz']
+                       ),
+                       // Non-existent id
+                       array(
+                               'foobar',
+                               null
+                       ),
+                       // Invalid ids
+                       array(
+                               42,
+                               null,
+                               'InvalidArgumentException'
+                       ),
+                       array(
+                               array( 'foo' ),
+                               null,
+                               'InvalidArgumentException'
+                       ),
+                       array(
+                               null,
+                               null,
+                               'InvalidArgumentException'
+                       )
+               );
+       }
 
-    /**
-     * Test cases for testGetWithIdentifierProperties
-     * @return array
-     */
-    public function getWithIdentifierPropertiesDataProvider() {
-        return array(
-            // Single identifier property id with single dump
-            array(
-                array( new PropertyId( 'P1' ) ),
-                array(
-                    'foo' => $this->dumpMetaInformation['foo']
-                )
-            ),
-            // Single identifier property id with multiple dump
-            array(
-                array( new PropertyId( 'P2' ) ),
-                array(
-                    'bar' => $this->dumpMetaInformation['bar'],
-                    'baz' => $this->dumpMetaInformation['baz']
-                )
-            ),
-            // Multiple identifier property id with multiple dump
-            array(
-                array(
-                    new PropertyId( 'P1' ),
-                    new PropertyId( 'P2' )
-                ),
-                array(
-                    'foo' => $this->dumpMetaInformation['foo'],
-                    'bar' => $this->dumpMetaInformation['bar'],
-                    'baz' => $this->dumpMetaInformation['baz']
-                )
-            ),
-            // Empty input array
-            array(
-                array(),
-                array()
-            ),
-            // Invalid identifier property ids
-            array(
-                array( 'P42' ),
-                null,
-                'InvalidArgumentException'
-            )
-        );
-    }
+       /**
+        * @dataProvider getWithIdsDataProvider
+        */
+       public function testGetWithIds( $dumpIds,
+               $expectedDumpMetaInformation,
+               $expectedException = null ) {
+               $this->setExpectedException( $expectedException );
+
+               $dumpMetaInformation = 
$this->dumpMetaInformationRepo->getWithIds( $dumpIds );
+
+               $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
+       }
+
+       /**
+        * @return array
+        */
+       public function getWithIdsDataProvider() {
+               return array(
+                       // Multiple ids
+                       array(
+                               array(
+                                       'foo',
+                                       'bar'
+                               ),
+                               array(
+                                       'foo' => 
$this->dumpMetaInformation['foo'],
+                                       'bar' => 
$this->dumpMetaInformation['bar']
+                               )
+                       ),
+                       // Empty array of dump ids
+                       array(
+                               array(),
+                               array()
+                       ),
+                       // Non-existent id
+                       array(
+                               array( 'foobar' ),
+                               array()
+                       ),
+                       // Invalid ids
+                       array(
+                               array( 42 ),
+                               null,
+                               'InvalidArgumentException'
+                       )
+               );
+       }
+
+       public function testGetAllDumpMetaInformation() {
+               $dumpMetaInformation = $this->dumpMetaInformationRepo->getAll();
+               $expectedDumpMetaInformation = array(
+                       'foo' => $this->dumpMetaInformation['foo'],
+                       'bar' => $this->dumpMetaInformation['bar'],
+                       'baz' => $this->dumpMetaInformation['baz']
+               );
+
+               $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
+       }
+
+       /**
+        * @dataProvider getWithIdentifierPropertiesDataProvider
+        */
+       public function testGetWithIdentifierProperties( $identifierPropertyIds,
+               $expectedDumpMetaInformation,
+               $expectedException = null ) {
+               $this->setExpectedException( $expectedException );
+
+               $dumpMetaInformation =
+                       
$this->dumpMetaInformationRepo->getWithIdentifierProperties( 
$identifierPropertyIds );
+
+               $this->assertEquals( $expectedDumpMetaInformation, 
$dumpMetaInformation );
+       }
+
+       /**
+        * Test cases for testGetWithIdentifierProperties
+        * @return array
+        */
+       public function getWithIdentifierPropertiesDataProvider() {
+               return array(
+                       // Single identifier property id with single dump
+                       array(
+                               array( new PropertyId( 'P1' ) ),
+                               array(
+                                       'foo' => 
$this->dumpMetaInformation['foo']
+                               )
+                       ),
+                       // Single identifier property id with multiple dump
+                       array(
+                               array( new PropertyId( 'P2' ) ),
+                               array(
+                                       'bar' => 
$this->dumpMetaInformation['bar'],
+                                       'baz' => 
$this->dumpMetaInformation['baz']
+                               )
+                       ),
+                       // Multiple identifier property id with multiple dump
+                       array(
+                               array(
+                                       new PropertyId( 'P1' ),
+                                       new PropertyId( 'P2' )
+                               ),
+                               array(
+                                       'foo' => 
$this->dumpMetaInformation['foo'],
+                                       'bar' => 
$this->dumpMetaInformation['bar'],
+                                       'baz' => 
$this->dumpMetaInformation['baz']
+                               )
+                       ),
+                       // Empty input array
+                       array(
+                               array(),
+                               array()
+                       ),
+                       // Invalid identifier property ids
+                       array(
+                               array( 'P42' ),
+                               null,
+                               'InvalidArgumentException'
+                       )
+               );
+       }
 
        public function testSourceItemIds() {
                $actualResult = 
$this->dumpMetaInformationRepo->getSourceItemIds();
@@ -305,71 +310,71 @@
                $this->assertArrayEquals( $expectedResult, $actualResult );
        }
 
-    /**
-     * @dataProvider saveDumpMetaInformationDataProvider
-     */
-    public function testSaveDumpMetaInformation( DumpMetaInformation 
$dumpMetaInformation ) {
-        $this->dumpMetaInformationRepo->save( $dumpMetaInformation );
+       /**
+        * @dataProvider saveDumpMetaInformationDataProvider
+        */
+       public function testSaveDumpMetaInformation( DumpMetaInformation 
$dumpMetaInformation ) {
+               $this->dumpMetaInformationRepo->save( $dumpMetaInformation );
 
-        $this->assertSelect(
-            SqlDumpMetaInformationRepo::META_TABLE_NAME,
-            array(
-                'id',
-                'source_qid',
-                'import_date',
-                'language',
-                'source_url',
-                'size',
-                'license_qid'
-            ),
-            array( 'id' => $dumpMetaInformation->getDumpId() ),
-            array(
-                array(
-                    $dumpMetaInformation->getDumpId(),
-                    
$dumpMetaInformation->getSourceItemId()->getSerialization(),
-                    $dumpMetaInformation->getImportDate(),
-                    $dumpMetaInformation->getLanguageCode(),
-                    $dumpMetaInformation->getSourceUrl(),
-                    $dumpMetaInformation->getSize(),
-                    
$dumpMetaInformation->getLicenseItemId()->getSerialization()
-                )
-            )
-        );
-    }
+               $this->assertSelect(
+                       SqlDumpMetaInformationRepo::META_TABLE_NAME,
+                       array(
+                               'id',
+                               'source_qid',
+                               'import_date',
+                               'language',
+                               'source_url',
+                               'size',
+                               'license_qid'
+                       ),
+                       array( 'id' => $dumpMetaInformation->getDumpId() ),
+                       array(
+                               array(
+                                       $dumpMetaInformation->getDumpId(),
+                                       
$dumpMetaInformation->getSourceItemId()->getSerialization(),
+                                       $dumpMetaInformation->getImportDate(),
+                                       $dumpMetaInformation->getLanguageCode(),
+                                       $dumpMetaInformation->getSourceUrl(),
+                                       $dumpMetaInformation->getSize(),
+                                       
$dumpMetaInformation->getLicenseItemId()->getSerialization()
+                               )
+                       )
+               );
+       }
 
-    /**
-     * Test cases for testSaveDumpMetaInformation
-     */
-    public function saveDumpMetaInformationDataProvider() {
-        $this->dumpMetaInformation['foo'] = new DumpMetaInformation(
-            $this->dumpMetaInformation['foo']->getDumpId(),
-            $this->dumpMetaInformation['foo']->getSourceItemId(),
-            $this->dumpMetaInformation['foo']->getIdentifierPropertyIds(),
-            $this->dumpMetaInformation['foo']->getImportDate(),
-            'de',
-            $this->dumpMetaInformation['foo']->getSourceUrl(),
-            $this->dumpMetaInformation['foo']->getSize(),
-            $this->dumpMetaInformation['foo']->getLicenseItemId()
-        );
+       /**
+        * Test cases for testSaveDumpMetaInformation
+        */
+       public function saveDumpMetaInformationDataProvider() {
+               $this->dumpMetaInformation['foo'] = new DumpMetaInformation(
+                       $this->dumpMetaInformation['foo']->getDumpId(),
+                       $this->dumpMetaInformation['foo']->getSourceItemId(),
+                       
$this->dumpMetaInformation['foo']->getIdentifierPropertyIds(),
+                       $this->dumpMetaInformation['foo']->getImportDate(),
+                       'de',
+                       $this->dumpMetaInformation['foo']->getSourceUrl(),
+                       $this->dumpMetaInformation['foo']->getSize(),
+                       $this->dumpMetaInformation['foo']->getLicenseItemId()
+               );
 
-        return array(
-            // Update existing one
-            array(
-                $this->dumpMetaInformation['foo']
-            ),
-            // Insert new one
-            array(
-                new DumpMetaInformation(
-                    'fubar',
-                    new ItemId( 'Q3' ),
-                    array( new PropertyId( 'P3' ) ),
-                    '20150101000000',
-                    'en',
-                    'http://www.fubar.com',
-                    42,
-                    new ItemId( 'Q6938433' )
-                )
-            )
-        );
-    }
+               return array(
+                       // Update existing one
+                       array(
+                               $this->dumpMetaInformation['foo']
+                       ),
+                       // Insert new one
+                       array(
+                               new DumpMetaInformation(
+                                       'fubar',
+                                       new ItemId( 'Q3' ),
+                                       array( new PropertyId( 'P3' ) ),
+                                       '20150101000000',
+                                       'en',
+                                       'http://www.fubar.com',
+                                       42,
+                                       new ItemId( 'Q6938433' )
+                               )
+                       )
+               );
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/224641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb53ea524800bd7521f5b2e856211e3116878cc6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to