Lucas Werkmeister (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382714 )
Change subject: Update steps to add a new constraint type in README
......................................................................
Update steps to add a new constraint type in README
DelegatingConstraintCheckerTest should also be updated, otherwise the
addition to the checker map in ConstraintReportFactory is not covered.
Change-Id: I447c8b275d50c99811c70b7ddb3436519863addf
---
M README.md
1 file changed, 18 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
refs/changes/14/382714/1
diff --git a/README.md b/README.md
index ec2901b..a4d3e5c 100644
--- a/README.md
+++ b/README.md
@@ -184,7 +184,7 @@
as members of the `config` object.
* It should be added right after the current last `…ConstraintId` entry.
* It should be named after the constraint type item’s English label,
- following the pattern `WBQualityConstraints___ConstraintId`.
+ following the pattern `WBQualityConstraints…ConstraintId`.
* The default value should be the item ID on Wikidata,
so that no extra configuration is required for Wikidata
and importing the constraint type item (see “Data import” section) works.
@@ -194,8 +194,8 @@
* Configure the constraint type checker in `ConstraintReportFactory`.
* Add an array entry like
```php
- $this->config->get( 'WBQualityConstraints___ConstraintId' )
- => new ___Checker(
+ $this->config->get( 'WBQualityConstraints…ConstraintId' )
+ => new …Checker(
// injected services
),
```
@@ -211,7 +211,7 @@
* It should have at least the following class-level documentation comment:
```php
/**
- * @covers
\WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\___Checker
+ * @covers
\WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\…Checker
*
* @group WikibaseQualityConstraints
*
@@ -235,5 +235,18 @@
* You can copy+paste a `getConstraintMock` function from one of the existing
tests,
adjusting the `getConstraintTypeItemId` mocked return value.
(Hopefully we’ll improve this in the future.)
+* Update the tests for `DelegatingConstraintChecker`.
+ * In `DelegatingConstraintCheckerTest`,
+ add an entry for your constraint type to the `$constraints` array in
`addDBData()`.
+ * The `constraint_guid` should be `P1$`,
+ followed by a new UUID (e. g. `cat /proc/sys/kernel/random/uuid` or
`journalctl --new-id128`).
+ * The `pid` should be `1`. (Not `'1'`!)
+ * The `constraint_type_qid` should be `$this->getConstraintTypeItemId( '…'
)`,
+ where `…` is just the `…` part of the
`WBQualityConstraints…ConstraintId` `extension.json` config key.
+ * The `constraint_parameters` should be a valid JSON serialization of
constraint parameters.
+ If the constraint type doesn’t have any parameters, you can pass `{}`,
+ otherwise there should ideally be methods to create the parameters in
the `ConstraintParameters` trait
+ so that you can use `json_encode( $this->…Parameter( … ) )`
+ (perhaps with `array_merge` if there are multiple parameters).
-An example commit that performs all of these steps is [Change
Id45d80e7a0](https://gerrit.wikimedia.org/r/381005).
+An example commit that performs all of these steps is TODO UPDATE [Change
Id45d80e7a0](https://gerrit.wikimedia.org/r/381005).
--
To view, visit https://gerrit.wikimedia.org/r/382714
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I447c8b275d50c99811c70b7ddb3436519863addf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits