Page MenuHomePhabricator

WikiLambda: Add ZObject::getSerialized() unit tests
Closed, ResolvedPublic

Description

ZObject.php and all its inheriting classes (all classes in the ZObjects directory) have a getSerialized() method that transforms a tree of ZObject instances into the JSON representation of that ZObject in canonical or normal form.

Tests for all ZObject classes should be added to check that the instances are serialized properly.

Current code: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiLambda/+/refs/heads/master/includes/ZObjects/ZObject.php#243 plus that method in sub-classes where over-ridden.
Current coverage report example: https://doc.wikimedia.org/cover-extensions/WikiLambda/includes/ZObjects/ZString.php.html#64

Event Timeline

gengh renamed this task from Add ZObject::serialize() tests in WikiLambda to WikiLambda: Add ZObject::getSerialized() unit tests.Nov 30 2021, 2:19 PM
gengh added a project: good first task.
gengh updated the task description. (Show Details)
gengh removed gengh as the assignee of this task.Mar 17 2022, 9:11 AM

Change 936308 had a related patch set uploaded (by William Avery; author: William Avery):

[mediawiki/extensions/WikiLambda@master] Commit of WIP for comment

https://gerrit.wikimedia.org/r/936308

I have evidently messed up and overwritten some changes of T332865 regarding self versus $tthis

@Aklapper Thank you for your help
Tests are currently failing in ZObjectTest.php because
$testObject->getSerialized( $testObject::FORM_NORMAL )
is returning an object of type stdClass rather than a string.

I've responded to the patch in gerrit.

Jdforrester-WMF changed the task status from Open to In Progress.Oct 26 2023, 4:51 PM
Aklapper changed the task status from In Progress to Open.Apr 11 2025, 10:15 PM

Resetting task status from "In Progress" to "Open" as this task has been "in progress" for more than one and a half years (see T380300).

Change #936308 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Add ZObject::getSerialized() unit tests - WIP for comment

https://gerrit.wikimedia.org/r/936308

@gengh, could you please take a look at this and verify if it is solved?