Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/224416
Change subject: Remove not needed class_exists check ...................................................................... Remove not needed class_exists check Also see Idf2cb08. Change-Id: I1f7909c7b08e1fb867b0ef8ef5a774a62b29294c --- M maintenance/UpdateConstraintsTable.php M tests/phpunit/Maintenance/UpdateConstraintsTableTest.php 2 files changed, 10 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/16/224416/1 diff --git a/maintenance/UpdateConstraintsTable.php b/maintenance/UpdateConstraintsTable.php index 6d43759..92636fd 100644 --- a/maintenance/UpdateConstraintsTable.php +++ b/maintenance/UpdateConstraintsTable.php @@ -6,11 +6,9 @@ use WikibaseQuality\ConstraintReport\Constraint; use WikibaseQuality\ConstraintReport\ConstraintReportFactory; -if( !class_exists( '\Maintenance' ) ) { - $basePath = getenv( "MW_INSTALL_PATH" ) !== false ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; - require_once $basePath . "/maintenance/Maintenance.php"; -} +$basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' ) : __DIR__ . '/../../..'; +require_once $basePath . '/maintenance/Maintenance.php'; /** * Class UpdateConstraintsTable @@ -26,15 +24,15 @@ public function __construct() { parent::__construct(); - $this->mDescription = "Reads csv file and writes its contents into constraints table"; + $this->mDescription = 'Reads csv file and writes its contents into constraints table'; $this->addOption( 'csv-file', 'csv file that contains constraints parsed from the property talk pages.', true, true ); $this->setBatchSize( 1000 ); } public function execute(){ $csvFile = fopen( $this->getOption( 'csv-file' ), 'rb' ); - if( !$csvFile ) { - $this->error( "Error while opening csv-file", 1 ); + if ( !$csvFile ) { + $this->error( 'Error while opening csv-file', 1 ); } $constraintRepo = ConstraintReportFactory::getDefaultInstance()->getConstraintRepository(); @@ -44,7 +42,6 @@ } private function insertValues( $constraintRepo, $csvFile ) { - $i = 0; $db = wfGetDB( DB_MASTER ); $accumulator = array(); @@ -68,12 +65,12 @@ } } - $constraintParameters = (array) json_decode( $data[3] ); + $constraintParameters = (array)json_decode( $data[3] ); $propertyId = new PropertyId( 'P' . $data[1] ); $accumulator[] = new Constraint( $data[0], $propertyId, $data[2], $constraintParameters ); } - } + } // @codeCoverageIgnoreStart diff --git a/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php b/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php index 7232faa..6d47ba0 100755 --- a/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php +++ b/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php @@ -4,7 +4,6 @@ use WikibaseQuality\ConstraintReport\Maintenance\UpdateConstraintsTable; - /** * @covers WikibaseQuality\ConstraintReport\Maintenance\UpdateConstraintsTable * @@ -19,6 +18,7 @@ protected function setup() { parent::setup(); + $this->tablesUsed[] = CONSTRAINT_TABLE; } @@ -83,4 +83,5 @@ ) ); } -} \ No newline at end of file + +} -- To view, visit https://gerrit.wikimedia.org/r/224416 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1f7909c7b08e1fb867b0ef8ef5a774a62b29294c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: v1 Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits