Page MenuHomePhabricator

WikiLambda: Add ZObject::getSerialized() unit tests
Open, In Progress, MediumPublic

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