} public static function cleanupCustomFieldsProvider(): \Generator
{ yield 'Test empty cart' =>
[ new Cart('test'
),
[],
];
yield 'Test strip payload' =>
[ self::
payloadCart('foo',
['customFields' =>
['bar' => 1
]]),
['foo' =>
['customFields' =>
[]], 'foo-child' =>
['customFields' =>
[]]],
];
yield 'Test allowed field' =>
[ self::
payloadCart('foo',
['customFields' =>
['bar' => 1
]]),
['foo' =>
['customFields' =>
['bar' => 1
]], 'foo-child' =>
['customFields' =>
['bar' => 1
]]],
['bar'
],
];
yield 'Test multiple allowed fields' =>
[ self::
payloadCart('foo',
['customFields' =>
['bar' => 1, 'baz' => 2
]]),
[