1
0
mirror of synced 2024-11-25 07:20:16 +01:00
CyberChef/test/tests/operations/PHP.mjs

69 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-11-13 04:10:28 +01:00
/**
* PHP tests.
2017-11-13 04:10:28 +01:00
*
* @author Jarmo van Lenthe
*
* @copyright Crown Copyright 2017
2017-11-16 13:37:11 +01:00
* @license Apache-2.0
2017-11-13 04:10:28 +01:00
*/
import TestRegister from "../../TestRegister";
2017-11-13 04:10:28 +01:00
TestRegister.addTests([
{
name: "PHP Deserialize empty array",
input: "a:0:{}",
expectedOutput: "{}",
recipeConfig: [
{
op: "PHP Deserialize",
args: [true],
},
],
},
{
name: "PHP Deserialize integer",
input: "i:10;",
expectedOutput: "10",
recipeConfig: [
{
op: "PHP Deserialize",
args: [true],
},
],
},
{
name: "PHP Deserialize string",
input: "s:17:\"PHP Serialization\";",
expectedOutput: "\"PHP Serialization\"",
recipeConfig: [
{
op: "PHP Deserialize",
args: [true],
},
],
},
{
name: "PHP Deserialize array (JSON)",
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
expectedOutput: "{\"a\": 10,\"0\": {\"ab\": true}}",
recipeConfig: [
{
op: "PHP Deserialize",
args: [true],
},
],
},
{
name: "PHP Deserialize array (non-JSON)",
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
expectedOutput: "{\"a\": 10,0: {\"ab\": true}}",
recipeConfig: [
{
op: "PHP Deserialize",
args: [false],
},
],
},
]);