From d1a22e34b9c0b7f23e0ef18893e955d5b626b56d Mon Sep 17 00:00:00 2001 From: "Jamie (Bear) Murphy" Date: Tue, 13 May 2025 22:27:44 +0100 Subject: [PATCH] adding more tests + fixing again --- tests/operations/tests/PHP.mjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/operations/tests/PHP.mjs b/tests/operations/tests/PHP.mjs index 314af23e..30ec65d4 100644 --- a/tests/operations/tests/PHP.mjs +++ b/tests/operations/tests/PHP.mjs @@ -46,7 +46,7 @@ TestRegister.addTests([ { name: "PHP Deserialize array (JSON)", input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}", - expectedOutput: "{\"0\": {\"ab\": true},\"a\": 10}", + expectedOutput: '{"0":{"ab":true},"a":10}', recipeConfig: [ { op: "PHP Deserialize", @@ -57,7 +57,7 @@ TestRegister.addTests([ { name: "PHP Deserialize array (non-JSON)", input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}", - expectedOutput: "{0: {\"ab\": true},\"a\": 10}", + expectedOutput: '{0:{"ab":true},"a":10}', recipeConfig: [ { op: "PHP Deserialize", @@ -65,4 +65,15 @@ TestRegister.addTests([ }, ], }, + { + name: "PHP Deserialize array with object and reference", + input: 'a:1:{s:6:"navbar";O:18:"APP\View\Menu\Item":3:{s:7:"�*�name";s:16:"Secondary Navbar";s:11:"�*�children";a:1:{s:9:"View Cart";O:18:"APP\View\Menu\Item":2:{s:7:"�*�name";s:9:"View Cart";s:9:"�*�parent";r:2;}}s:9:"�*�parent";N;}}', + expectedOutput: '{"navbar":{"__className":"APP\\View\\Menu\\Item","�*�name":"Secondary Navbar","�*�children":{"View Cart":{"__className":"APP\\View\\Menu\\Item","�*�name":"View Cart","�*�parent":"Secondary Navbar"}},"�*�parent":null}}', + recipeConfig: [ + { + op: "PHP Deserialize", + args: [false], + }, + ], + } ]);