Commit Graph

70 Commits

Author SHA1 Message Date
Rodrigo Primo 95b14b3674 Merge branch 'master' into fix/includes-cli-phpcs-violations 2018-03-06 10:32:56 -03:00
Rodrigo Primo 57ae5d8150 WooCommerce CLI commands use anonymous functions
Contrary to the rest of the WC codebase, WC CLI commands require PHP >= 5.5 and use anonymous functions. This commit excludes the PHPCombatibility rule for anonymous functions (PHPCompatibility.PHP.NewClosure.Found) when PHPCS is checking the `includes/cli` directory.
2018-03-06 08:46:28 -03:00
Rodrigo Primo 82f99c4042 Don't check for PHPCompatibility.PHP.NewFunctions.array_columnFound in the includes/cli directory
WooCommerce CLI commands use array_column() which was added in PHP 5.5. Since this was not noticed until now it is probably not worth changing and making the code compatible with PHP < 5.5.
2018-03-06 08:12:37 -03:00
Rodrigo Primo 557e85c1d6 Don't check for PHPCompatibility.PHP.NewLanguageConstructs.t_ns_separatorFound in the includes/cli directory
WooCommerce CLI commands require PHP >= 5.3 so namespace separators can be used in the code.
2018-03-06 08:02:01 -03:00
Claudio Sanches d43cd90cb3 Fixed PHPCS violations on i18n directory 2018-03-05 16:44:56 -03:00
Shiva Poudel 6bad005c5b Delete user meta data on uninstall 2018-02-11 16:25:30 +05:45
Shiva Poudel 939d8043ec PHPCS fix 2018-02-10 10:41:06 +05:45
Claudio Sanches 2b132630a1 Do not allow WordPress.PHP.DevelopmentFunctions.error_log_print_r 2018-02-02 14:20:17 -02:00
Claudio Sanches 0755038e8d
Merge pull request #18505 from liquidweb/feature/post-system-status-tool-hook
Add a hook after executing a REST system status tool
2018-02-02 14:19:03 -02:00
Mike Jolley 057b40e044 Remove kses from before/after attribute
Closes #18643
2018-01-30 11:45:00 +00:00
Steve Grunwell 16b59b60a0 Merge branch 'master' into feature/post-system-status-tool-hook 2018-01-24 01:45:44 +00:00
Mike Jolley 1c92b970a9 Use only review count
Closes #18558
2018-01-23 11:03:30 +00:00
Steve Grunwell 2ffb8c8481 Exclude tests/e2e-tests/ from the PEAR.Functions.FunctionCallSignature.EmptyLine sniff, or risk a ton of 'Empty lines are not allowed in multi-line function calls' errors. 2018-01-22 03:42:05 +00:00
Steve Grunwell 3f7034602f Don't enforce filename or inline commenting standards against the tests/ directory 2018-01-22 03:23:48 +00:00
Steve Grunwell 8c3fd0c75f Don't flag instances of print_r() within the tests/ directory.
In some cases, calls like `print_r( $data, true )` (return the printed array as a string) can be helpful for providing context if/when a test fails.
2018-01-17 22:10:56 +00:00
Steve Grunwell b7825faa39 Don't hold the test suite to the same naming conventions as WordPress/WooCommerce. 2018-01-17 21:50:18 +00:00
Steve Grunwell 4cded5e9aa Exclude the /tests/ directory from PHP Compatibility checks
The composer.json file in WooCommerce specifies PHPUnit version 6.2.3 as a development dependency; that version of PHPUnit sets PHP 7.0 as the minimum PHP version, effectively making the minimum development version for WooCommerce to be PHP 7.0 (hooray!).

With a more modern version of PHP as the minimum requirement for developers, the code that isn't distributed with the plugin (e.g. the /tests/ directory) doesn't necessarily need to adhere to PHP 5.2-compatible coding standards. This commit removes the /tests/ directory from the scope of the PHP Compatibility checks, enabling the test suite to leverage modern (relative to PHP 5.2, anyway) features like closures, short-array syntax, and namespaces. Embracing more modern PHP in the test suite also opens up the possibilities of using libraries like Faker to populate dummy data, rather than the hard-coded helpers that exist now.

An example test enabled by this change: developers can now use closures for filter callbacks.

    add_filter( 'some_filter', function () {
        return 'the filtered value';
    }

    $this->assertEquals( 'the filtered value', my_function() );

Without a closure, this test would need to either write a one-off method in the test class or hack around it with static properties to configure the expected filter response.
2018-01-11 23:17:22 +00:00
Claudio Sanches 5b15dbe8fe Ignore "namespace" used in REST API 2018-01-11 13:11:24 -02:00
Claudio Sanches 61b5c7a445 Added WooCommerce-Core sniffs 2017-12-21 21:29:49 -02:00
Rodrigo Primo bf052c14c7 Use default name for PHPCS configuration file
This commit renames PHPCS configutarion file to `phpcs.xml`. With the default name, it is not necessary to use the argument `--standard=phpcs.ruleset.xml` anymore when calling `phpcs`.
2017-12-18 11:49:44 -02:00