This commit moves two functions declared inside a test method to their
own protected methods inside the same test class to make it easier to
read the tests and it fixes the order of the parameters for the calls to
Assert::assertEquals(). The first parameter passed to this method should
be the expected value and the second parameter should be the actual
value and not the opposite.
This commit fixes all 1533 PHPCS errors that PHPCBF can fix automatically in the tests/ directory. Before this change there was a total of 3106 PHPCS errors in the WooCommerce repository and now there is 1573 errors.
PR #23196 added a workaround to `parse_str()` limitation when dealing with full-stops, pluses, and spaces in the parameter key. This workaround involved temporarily replacing those three characters with placeholders before calling `parse_str()` and then replacing back to the original form. This commit fixes a bug in this logic that was replacing back only parameters keys and not parameters values.
For example, if the query string is `?query.parameter=foo.bar`, the resulting <input> field contained `foo{dot}bar`, instead of the expected `foo.bar`.
It is not necessary to use the $message parameter of assertEquals() to output the value of $actual_html, as PHPUnit already output this variable value in case of error.
PR https://github.com/woocommerce/woocommerce/pull/23082 made some changes to the Travis configuration and one of those changes broke the PHPCS when running inside Travis with the following error:
```
ERROR: Referenced sniff "WooCommerce-Core" does not exist
```
For example: https://travis-ci.org/woocommerce/woocommerce/jobs/509471213#L659
This problem went unnoticed during the PR review as no PHP file was modified in it and thus there was no file for PHPCS to check.
This commit fixes the error above by installing the Composer package `woocommerce/woocommerce-sniffs` which is the package that provides `WooCommerce-Core` sniffs and which installs `wp-coding-standards/wpcs` as one of its requirements. I couldn't find an easy way to make this work installing `woocommerce/woocommerce-sniffs` globally so that is why this commit also removes the `global` parameter when calling composer.