catalyst / moodle-tool_abconfig

A way to A/B test config, or slowly turn on config for certain audiences or % of traffic
https://moodle.org/plugins/tool_abconfig
6 stars 4 forks source link

Clean up commands from unexpected EOL #40

Closed golenkovm closed 2 years ago

golenkovm commented 2 years ago

This is to fix #39

keevan commented 2 years ago

Hi @golenkovm, are you able to add unit tests for this? And I wonder if it would work if you str_replace using "\r\n" instead of doing them separately.

Also based on the example in the issue, would you be able to use trim instead, as it seems to be set at the end of the string (line) and by default trim covers the characters you want removed.

golenkovm commented 2 years ago

Good catch @keevan I like using trim here. Speaking of unit tests I had to move the part where json magic is happening from the edit form to a dedicated method to make it possible to properly cover with unit tests.