magento2-functional-testing-framework
magento2-functional-testing-framework copied to clipboard
Cannot set JSON config value using magentoCLI
Preconditions
- Magento 2.3.4 (incl. Vertex) w/ MFTF 2.5.3 (cursory glance suggests issue occurs with
develop
branch)
Steps to reproduce
- Modify test VertexAsRegisteredCustomerCheckTaxWhenFlexibleFieldIsSentForEcoProducts to not after step
setupFlexFieldConfig
- Modify before step
setupFlexFieldConfig
in same test to be:
<magentoCLI stepKey="setupFlexFieldConfig" command="config:set" arguments='tax/vertex_flexfields/code '[{"field_id":"1","field_source":"product.custom.$$createProductAttribute.attribute_code$$"}]'' />
- Check
core_config_data
table for path 'tax/vertex_flexfields/code'
Expected result
- Value is
[{"field_id":"1","field_source":"product.custom.[CODE]"}]
Actual result
- Value is
\[\{\"field_id\":\"1\",\"field_source\":\"product.custom.[CODE]\"\}\]
This is caused by PHP's escapeshellcmd
method call: https://github.com/magento/magento2-functional-testing-framework/blob/develop/etc/config/command.php#L26
https://github.com/magento/magento2-functional-testing-framework/blob/d82e6cf1e798a3266ae23582ae53fc6b77fa452d/etc/config/command.php#L25-L27
If the '
is not included, the result instead has the brackets not escaped (properly) but removes the quotation marks entirely. I have failed to find any combination of escaping that comes out of escapeshellcmd
in a way that sets this configuration value correctly.
By itself, it is handled properly by escapeshellarg
but I am not aware of any reliable way to automatically determine individual arguments in $arguments
Idea 1: Add noEscape
tag to <magentoCLI
, that disables escape for arguments=""
CC @okolesnyk
@navarr Thank you for reporting the issue! Internal ticket https://jira.corp.magento.com/browse/MQE-2239 is created.
Hey @navarr Could you please confirm if that's still an issue? We fixed a similar issue quite a while ago and before closing this one I just want to make sure it works. Thanks