Dominic.sauer has uploaded a new change for review.
https://gerrit.wikimedia.org/r/204244
Change subject: add qqx as language and add some matchers
......................................................................
add qqx as language and add some matchers
Change-Id: I33b983fe221a5eeace7c9f1ee4658b8d826e91d9
---
M constraint-report/specials/SpecialConstraintReport.php
M constraint-report/tests/phpunit/Specials/SpecialConstraintReportTest.php
M external-validation/sql/create_wdqa_external_data.sql
M external-validation/tests/phpunit/Specials/SpecialCrossCheckTest.php
M external-validation/tests/phpunit/Specials/SpecialExternalDbsTest.php
M i18n/de.json
6 files changed, 354 insertions(+), 233 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQuality
refs/changes/44/204244/1
diff --git a/constraint-report/specials/SpecialConstraintReport.php
b/constraint-report/specials/SpecialConstraintReport.php
old mode 100644
new mode 100755
index 288ebee..4f2324d
--- a/constraint-report/specials/SpecialConstraintReport.php
+++ b/constraint-report/specials/SpecialConstraintReport.php
@@ -100,7 +100,7 @@
$constraintChecker = new ConstraintChecker( $this->entityLookup
);
$results = $constraintChecker->execute( $entity );
- $this->saveResultsInViolationsTable( $results );
+ #$this->saveResultsInViolationsTable( $results );
return $results;
}
diff --git
a/constraint-report/tests/phpunit/Specials/SpecialConstraintReportTest.php
b/constraint-report/tests/phpunit/Specials/SpecialConstraintReportTest.php
index 39e3e13..dfc8498 100755
--- a/constraint-report/tests/phpunit/Specials/SpecialConstraintReportTest.php
+++ b/constraint-report/tests/phpunit/Specials/SpecialConstraintReportTest.php
@@ -129,122 +129,8 @@
);
}
- public function executeProvider() {
- $cases = array();
- $matchers = array();
-
- // Empty input
- $matchers['entityId'] = array(
- 'tag' => 'input',
- 'attributes' => array(
- 'placeholder' => 'Qxx/Pxx',
- 'name' => 'entityId',
- 'class' => 'wdq-checkresult-form-entity-id mw-ui-input'
- )
- );
-
- $matchers['submit'] = array(
- 'tag' => 'input',
- 'attributes' => array(
- 'class' => 'wbq-checkresult-form-submit',
- 'type' => 'submit',
- 'value' => 'Check',
- 'name' => 'submit'
- )
- );
-
- $cases['empty'] = array('', array(), null, $matchers);
-
- // Invalid input (en)
- $matchers['error'] = array(
- 'tag' => 'p',
- 'attributes' => array(
- 'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
- ),
- 'content' => 'Invalid entity ID!'
- );
-
- $cases['invalid input 1'] = array( 'Qwertz', array(), 'en', $matchers
);
- $cases['invalid input 2'] = array( '300', array(), 'en', $matchers );
-
- // Valid input (en) but entity does not exist
- unset( $matchers['error'] );
- $matchers['error'] = array(
- 'tag' => 'p',
- 'attributes' => array(
- 'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
- ),
- 'content' => 'Entity does not exist!'
- );
-
- $cases['valid input - not existing item'] = array(
self::NOT_EXISTENT_ITEM_ID, array(), 'en', $matchers );
-
- // Valid input (en) and entity exists
- unset( $matchers['error'] );
- $matchers['result for'] = array(
- 'tag' => 'h3',
- 'content' => 'Result for'
- );
-
- $matchers['result table'] = array(
- 'tag' => 'table',
- 'attributes' => array(
- 'class' => 'wikitable sortable jquery-tablesort'
- )
- );
-
- $matchers['column status'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Status'
- );
-
- $matchers['compliance'] = array(
- 'tag' => 'span',
- 'attributes' => array(
- 'class' => 'wdq-status wdq-status-success'
- ),
- 'content' => 'Compliance'
- );
-
- $matchers['violation'] = array(
- 'tag' => 'span',
- 'attributes' => array(
- 'class' => 'wdq-status wdq-status-error'
- ),
- 'content' => 'Violation'
- );
-
- $matchers['column claim'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Claim'
- );
-
- $matchers['column constraint'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Constraint'
- );
-
- $cases['valid input - existing item'] = array( '$id', array(), 'en',
$matchers );
-
- return $cases;
- }
-
/**
* @dataProvider executeProvider
- *
- * @param string $sub The subpage parameter to call the page with
- * @param WebRequest|null $request Web request that may contain URL
parameters, etc
- * @param string $userLanguage The language code which should be used in
the context of this special page
- * @param $matchers
*/
public function testExecute( $subPage, $request, $userLanguage, $matchers
) {
$request = new \FauxRequest( $request );
@@ -260,5 +146,125 @@
}
}
+ public function executeProvider()
+ {
+ $userLanguage = 'qqx';
+ $cases = array();
+ $matchers = array();
+
+ // Empty input
+ $matchers['instructions'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-constraintreport-instructions)'
+ );
+
+ $matchers['instructions example'] = array(
+ 'tag' => 'p',
+ 'content' =>
'(wikidataquality-constraintreport-instructions-example)'
+ );
+
+ $matchers['entityId'] = array(
+ 'tag' => 'input',
+ 'attributes' => array(
+ 'placeholder' =>
'(wikidataquality-checkresult-form-entityid-placeholder)',
+ 'name' => 'entityId',
+ 'class' => 'wdq-checkresult-form-entity-id mw-ui-input'
+ )
+ );
+
+ $matchers['submit'] = array(
+ 'tag' => 'input',
+ 'attributes' => array(
+ 'class' => 'wbq-checkresult-form-submit',
+ 'type' => 'submit',
+ 'value' => '(wikidataquality-checkresult-form-submit-label)',
+ 'name' => 'submit'
+ )
+ );
+
+ $cases['empty'] = array('', array(), $userLanguage, $matchers);
+
+ // Invalid input
+ $matchers['error'] = array(
+ 'tag' => 'p',
+ 'attributes' => array(
+ 'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
+ ),
+ 'content' => '(wikidataquality-checkresult-invalid-entity-id)'
+ );
+
+ $cases['invalid input 1'] = array( 'Qwertz', array(), $userLanguage,
$matchers );
+ $cases['invalid input 2'] = array( '300', array(), $userLanguage,
$matchers );
+
+ // Valid input but entity does not exist
+ unset( $matchers['error'] );
+ $matchers['error'] = array(
+ 'tag' => 'p',
+ 'attributes' => array(
+ 'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
+ ),
+ 'content' => '(wikidataquality-checkresult-not-existent-entity)'
+ );
+
+ $cases['valid input - not existing item'] = array(
self::NOT_EXISTENT_ITEM_ID, array(), $userLanguage, $matchers );
+
+ // Valid input and entity exists
+ unset( $matchers['error'] );
+ $matchers['result for'] = array(
+ 'tag' => 'h3',
+ 'content' => '(wikidataquality-checkresult-result-headline:'
+ );
+
+ $matchers['result table'] = array(
+ 'tag' => 'table',
+ 'attributes' => array(
+ 'class' => 'wikitable sortable jquery-tablesort'
+ )
+ );
+
+ $matchers['column status'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' =>
'(wikidataquality-checkresult-result-table-header-status)'
+ );
+
+ $matchers['column claim'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' =>
'(wikidataquality-constraintreport-result-table-header-claim)'
+ );
+
+ $matchers['column constraint'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' =>
'(wikidataquality-constraintreport-result-table-header-constraint)'
+ );
+
+ $matchers['value status - violation'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'class' => 'wdq-status wdq-status-error'
+ ),
+ 'content' => '(wikidataquality-checkresult-status-violation)'
+ );
+
+ $matchers['value status - compliance'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'class' => 'wdq-status wdq-status-success'
+ ),
+ 'content' => '(wikidataquality-checkresult-status-compliance)'
+ );
+
+ $cases['valid input - existing item'] = array( '$id', array(),
$userLanguage, $matchers );
+
+ return $cases;
+ }
}
\ No newline at end of file
diff --git a/external-validation/sql/create_wdqa_external_data.sql
b/external-validation/sql/create_wdqa_external_data.sql
old mode 100644
new mode 100755
diff --git
a/external-validation/tests/phpunit/Specials/SpecialCrossCheckTest.php
b/external-validation/tests/phpunit/Specials/SpecialCrossCheckTest.php
index 748f5db..06142c0 100755
--- a/external-validation/tests/phpunit/Specials/SpecialCrossCheckTest.php
+++ b/external-validation/tests/phpunit/Specials/SpecialCrossCheckTest.php
@@ -209,14 +209,25 @@
*/
public function executeProvider()
{
+ $userLanguage = 'qqx';
$cases = array();
$matchers = array();
// Empty input
+ $matchers['instructions'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-crosscheck-instructions)'
+ );
+
+ $matchers['instructions example'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-crosscheck-instructions-example)'
+ );
+
$matchers['entityId'] = array(
'tag' => 'input',
'attributes' => array(
- 'placeholder' => 'Qxx/Pxx',
+ 'placeholder' =>
'(wikidataquality-checkresult-form-entityid-placeholder)',
'name' => 'entityId',
'class' => 'wdq-checkresult-form-entity-id mw-ui-input'
)
@@ -227,42 +238,42 @@
'attributes' => array(
'class' => 'wbq-checkresult-form-submit',
'type' => 'submit',
- 'value' => 'Check',
+ 'value' => '(wikidataquality-checkresult-form-submit-label)',
'name' => 'submit'
)
);
- $cases['empty'] = array('', array(), null, $matchers);
+ $cases['empty'] = array('', array(), $userLanguage, $matchers);
- // Invalid input (en)
+ // Invalid input
$matchers['error'] = array(
'tag' => 'p',
'attributes' => array(
'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
),
- 'content' => 'Invalid entity ID!'
+ 'content' => '(wikidataquality-checkresult-invalid-entity-id)'
);
- $cases['invalid input 1'] = array( 'Qwertz', array(), 'en', $matchers
);
- $cases['invalid input 2'] = array( '300', array(), 'en', $matchers );
+ $cases['invalid input 1'] = array( 'Qwertz', array(), $userLanguage,
$matchers );
+ $cases['invalid input 2'] = array( '300', array(), $userLanguage,
$matchers );
- // Valid input (en) but entity does not exist
+ // Valid input but entity does not exist
unset( $matchers['error'] );
$matchers['error'] = array(
'tag' => 'p',
'attributes' => array(
'class' => 'wdq-checkresult-notice
wdq-checkresult-notice-error'
),
- 'content' => 'Entity does not exist!'
+ 'content' => '(wikidataquality-checkresult-not-existent-entity)'
);
- $cases['valid input - not existing item'] = array(
self::NOT_EXISTENT_ITEM_ID, array(), 'en', $matchers );
+ $cases['valid input - not existing item'] = array(
self::NOT_EXISTENT_ITEM_ID, array(), $userLanguage, $matchers );
- // Valid input (en) and entity exists
+ // Valid input and entity exists
unset( $matchers['error'] );
$matchers['result for'] = array(
'tag' => 'h3',
- 'content' => 'Result for'
+ 'content' => '(wikidataquality-checkresult-result-headline:'
);
$matchers['result table'] = array(
@@ -277,23 +288,7 @@
'attributes' => array(
'role' => 'columnheader button'
),
- 'content' => 'Status'
- );
-
- $matchers['missing references'] = array(
- 'tag' => 'span',
- 'attributes' => array(
- 'class' => 'wdq-status wdq-status-warning'
- ),
- 'content' => 'Missing references'
- );
-
- $matchers['violation'] = array(
- 'tag' => 'span',
- 'attributes' => array(
- 'class' => 'wdq-status wdq-status-error'
- ),
- 'content' => 'Violation'
+ 'content' =>
'(wikidataquality-checkresult-result-table-header-status)'
);
$matchers['column property'] = array(
@@ -301,15 +296,15 @@
'attributes' => array(
'role' => 'columnheader button'
),
- 'content' => 'Property'
+ 'content' => '(datatypes-type-wikibase-property)'
);
- $matchers['column wikidata value'] = array(
+ $matchers['column local value'] = array(
'tag' => 'th',
'attributes' => array(
'role' => 'columnheader button'
),
- 'content' => 'Wikidata Value'
+ 'content' =>
'(wikidataquality-crosscheck-result-table-header-local-value)'
);
$matchers['column external value'] = array(
@@ -317,7 +312,7 @@
'attributes' => array(
'role' => 'columnheader button'
),
- 'content' => 'External Value'
+ 'content' =>
'(wikidataquality-crosscheck-result-table-header-external-value)'
);
$matchers['column external source'] = array(
@@ -325,10 +320,62 @@
'attributes' => array(
'role' => 'columnheader button'
),
- 'content' => 'External Source'
+ 'content' =>
'(wikidataquality-crosscheck-result-table-header-external-source)'
);
- $cases['valid input - existing item without references'] = array(
'$id', array(), 'en', $matchers );
+ $matchers['value status - references missing'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'class' => 'wdq-status wdq-status-warning'
+ ),
+ 'content' =>
'(wikidataquality-checkresult-status-references-missing)'
+ );
+
+ $matchers['value local value foo'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'foo'
+ );
+
+ $matchers['value external value foo'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'lang' => 'en',
+ 'class' => 'wb-monolingualtext-value'
+ ),
+ 'content' => 'foo'
+ );
+
+ $matchers['value status - violation'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'class' => 'wdq-status wdq-status-error'
+ ),
+ 'content' => '(wikidataquality-checkresult-status-violation)'
+ );
+
+ $matchers['value local value baz'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'baz'
+ );
+
+ $matchers['value external value bar'] = array(
+ 'tag' => 'span',
+ 'attributes' => array(
+ 'lang' => 'en',
+ 'class' => 'wb-monolingualtext-value'
+ ),
+ 'content' => 'bar'
+ );
+
+ $cases['valid input - existing item without references'] = array(
'$id', array(), $userLanguage, $matchers );
// TODO $cases['valid input - existing item with references'] = array(
'$id', array(), 'en', $matchers );
return $cases;
diff --git
a/external-validation/tests/phpunit/Specials/SpecialExternalDbsTest.php
b/external-validation/tests/phpunit/Specials/SpecialExternalDbsTest.php
old mode 100644
new mode 100755
index b1fae75..cb36811
--- a/external-validation/tests/phpunit/Specials/SpecialExternalDbsTest.php
+++ b/external-validation/tests/phpunit/Specials/SpecialExternalDbsTest.php
@@ -66,91 +66,8 @@
$dumpMetaInformation->save( $this->db );
}
- public function executeProvider()
- {
- $cases = array();
- $matchers = array();
-
- // Empty input with database
- $matchers['database table'] = array(
- 'tag' => 'table',
- 'attributes' => array(
- 'class' => 'wikitable'
- )
- );
-
- $matchers['column name'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Name'
- );
-
- $matchers['column import date'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Import date'
- );
-
- $matchers['column data language'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Data language'
- );
-
- $matchers['column source urls'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Source URLs'
- );
-
- $matchers['column size'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'Size'
- );
-
- $matchers['column license'] = array(
- 'tag' => 'th',
- 'attributes' => array(
- 'role' => 'columnheader button'
- ),
- 'content' => 'License'
- );
-
-
-
- $cases['empty with database'] = array('', array(), null, $matchers);
-
- // Empty input without databases
- unset( $matchers );
-
- $matchers['no databases'] = array(
- 'tag' => 'p',
- 'content' => 'No external databases available for cross-check.'
- );
-
- $cases['empty without databases'] = array('', array(), null,
$matchers);
-
- return $cases;
- }
-
/**
* @dataProvider executeProvider
- *
- * @param string $sub The subpage parameter to call the page with
- * @param WebRequest|null $request Web request that may contain URL
parameters, etc
- * @param string $userLanguage The language code which should be used in
the context of this special page
- * @param $matchers
*/
public function testExecute( $subPage, $request, $userLanguage, $matchers
) {
$request = new \FauxRequest( $request );
@@ -169,5 +86,155 @@
$this->assertTag( $matcher, $output, "Failed to assert output:
$key" );
}
}
+
+ public function executeProvider()
+ {
+ $userLanguage = 'qqx';
+ $cases = array();
+ $matchers = array();
+
+ // Empty input with database
+ $matchers['instructions'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-externaldbs-instructions)'
+ );
+
+ $matchers['headline'] = array(
+ 'tag' => 'h3',
+ 'content' => '(wikidataquality-externaldbs-overview-headline)'
+ );
+
+ $matchers['database table'] = array(
+ 'tag' => 'table',
+ 'attributes' => array(
+ 'class' => 'wikitable'
+ )
+ );
+
+ $matchers['column name'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-name)'
+ );
+
+ $matchers['column import date'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-import-date)'
+ );
+
+ $matchers['column data language'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-language)'
+ );
+
+ $matchers['column source urls'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-source-urls)'
+ );
+
+ $matchers['column size'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-size)'
+ );
+
+ $matchers['column license'] = array(
+ 'tag' => 'th',
+ 'attributes' => array(
+ 'role' => 'columnheader button'
+ ),
+ 'content' => '(wikidataquality-externaldbs-license)'
+ );
+
+ $matchers['value name'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'Q36578'
+ );
+
+ $matchers['value import date'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => '2015-01-01 00:00:00'
+ );
+
+ $matchers['value data language'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'English'
+ );
+
+ $matchers['value source urls'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'http://www.foo.bar'
+ );
+
+ $matchers['value size'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => '(size-bytes)'
+ );
+
+ $matchers['value license'] = array(
+ 'tag' => 'td',
+ 'attributes' => array(
+ 'rowspan' => '1',
+ 'colspan' => '1'
+ ),
+ 'content' => 'Q6938433'
+ );
+
+ $cases['empty with database'] = array('', array(), $userLanguage,
$matchers);
+
+ // Empty input without databases
+ unset( $matchers );
+ $matchers['instructions'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-externaldbs-instructions)'
+ );
+
+ $matchers['headline'] = array(
+ 'tag' => 'h3',
+ 'content' => '(wikidataquality-externaldbs-overview-headline)'
+ );
+
+ $matchers['no databases'] = array(
+ 'tag' => 'p',
+ 'content' => '(wikidataquality-externaldbs-no-databases)'
+ );
+
+ $cases['empty without databases'] = array('', array(), $userLanguage,
$matchers);
+
+ return $cases;
+ }
}
\ No newline at end of file
diff --git a/i18n/de.json b/i18n/de.json
old mode 100644
new mode 100755
index 48b0086..6252185
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -7,6 +7,7 @@
},
"wikidataquality-desc": "Ermöglicht die Migration und Verbesserung der
Verwendung von Beschränkungen durch das Visualisieren von
Beschränkungsberichten und das Kreuzprüfen von Daten mit externen Datenbanken
zur Sicherstellung der Qualität von Wikidata.",
"specialpages-group-wikidataquality": "Wikidata-Qualität",
+ "wikidataquality-checkresult-form-entityid-placeholder": "Qxx/Pxx",
"wikidataquality-checkresult-form-submit-label": "Überprüfen",
"wikidataquality-checkresult-invalid-entity-id": "Ungültige
Objektkennung!",
"wikidataquality-checkresult-not-existent-entity": "Objekt ist nicht
vorhanden!",
--
To view, visit https://gerrit.wikimedia.org/r/204244
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33b983fe221a5eeace7c9f1ee4658b8d826e91d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataQuality
Gerrit-Branch: master
Gerrit-Owner: Dominic.sauer <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits