Page MenuHomePhabricator

Move DataValues away from “withered” PHPUnit 4
Closed, ResolvedPublic5 Estimated Story Points

Description

As a developer, I want to be able to work on the data-values libraries using the newest PHP version.

Problem:
Some of our data-values libraries still use PHPUnit 4. WikibaseRepo has very clear words for this:

repo/tests/phpunit/includes/Parsers/PHPUnit4CompatTrait.php
/**                                                                                                                                                                          
 * Awful hack: several tests extend DataValues test classes. DataValues works on PHPUnit4 only, hence                                                                        
 * it uses setExpectedException (amongst other things). But Wikibase requires PHP 7.2+ and PHPUnit6+,                                                                        
 * where setExpectedException doesn't exist anymore. This was resolved by using the PHPUnit4And6Compat                                                                       
 * trait provided by core, but that's deprecated as of 1.34.                                                                                                                 
 *                                                                                                                                                                           
 * @todo Get rid of this trait as soon as DataValues moves away from withered PHPUnit.                                                                                       
 */
trait PHPUnit4CompatTrait {

PHPUnit 4 doesn’t even work under PHP 7.4 anymore, so it’s not possible to test these libraries under the latest released PHP version.

Example:
wmde/Time#149 is an attempt to pull data-values/time into the present day but it’s kicking and screaming and generally being annoying about it.

Note: Except https://github.com/wmde/Time, https://github.com/wmde/Number libraries involved here are not maintained by WMDE, therefore WMDE will only be able to provide updates and will not be in charge of releasing new versions.

Acceptance criteria:

Patch-For-Review:

Event Timeline

It turns out DataValues/DataValues was already updated by @MaxSem (pull request #54), there just hasn’t been a new release of the library yet.

WMDE-leszek set the point value for this task to 5.Oct 14 2020, 12:59 PM

As discussed in https://github.com/DataValues/DataValues/issues/58 we will try to remove interface usage from various touch points in wikibase code to unblock the release.

EDIT: See PR #382 in WikibaseDataModel and PR #62 in DataValues/DataValues

WMDE-leszek added a subscriber: WMDE-leszek.

Looks complete. Well done @Rosalie_WMDE and others involved!

https://github.com/DataValues/DataValues/pull/59 is still open, but I don't see as being a necessary part of this task.

Well done everybody! Should another task be created about the removal of PHPUnit4CompatTrait? That is blocked on bumping the versions of the affected DataValues libraries.