Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikidata, wdwb-tech, Sustainability
(Incident Followup).
Restricted Application added a subscriber: Aklapper.
TASK DESCRIPTION
Currently, a `SerializableEntityId`’s string representation is its
serialization, which means it’s equal (`==`) to its serialization string.
>>> ( new \Wikibase\DataModel\Entity\ItemId( 'Q1' ) ) == "Q1"
=> true
This means that tests involving entity IDs are less strict than they should
be: `assertEquals( new ItemId( 'Q1' ), $actual )` will pass if `$actual` is a
string, even if the test meant to expect an `ItemId`. This can hid real bugs:
see T293104 <https://phabricator.wikimedia.org/T293104> for an example.
The comment of the `__toString()` method mentions that “[t]his format is
allowed to change and should therefore not be relied upon to be stable”, but in
practice we have plenty of tests (and, presumably, non-test code) relying on
this behavior: see the results of this WIP change
<https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/730433/1>
(some 40 to 80 failures, depending on the CI job). I suggest that we fix all
these places – it’s not an insurmountable number – and then change
`__toString()` to return something that’s still human-readable, but not exactly
the serialization (e.g. adding the class name).
TASK DETAIL
https://phabricator.wikimedia.org/T293259
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Aklapper, Invadibot, maantietaja, Akuckartz,
Nandana, jijiki, Klaas_Z4us_V, Lahi, Gq86, GoranSMilovanovic, QZanden,
LawExplorer, elukey, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude,
Addshore, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]