Commit Graph

49 Commits

Author SHA1 Message Date
Nestor Soriano 2a68bb018d Move testing tools to the tests/Tools directory
The testing tools (only the code hacker at this time) have been moved
from 'src' to 'tests/Tools', since many opcode cache plugins
load the whole src folder in production.

Also, an extra autoloader is set in the tests bootstrap so that
the 'tests/Tools' directory corresponds, using PSR4, to the
'Automattic\WooCommerce\Testing\Tools' namespace.
2020-05-20 09:57:39 +02:00
vedanshujain a74f06f337 Add exception for tests/php for filename sniff because it conflicts with PSR4. 2020-05-05 19:22:21 +05:30
vedanshujain ae68e16070 Add back phpcs for legacy because we still want it tested.
There are lots of tests in legacy folder which we might update from time to time. Its still a good idea to keep phpcs for the folder.
2020-05-05 18:50:54 +05:30
Christopher Allford 857b2231f7 Added a phpcs exclusion to legacy unit tests 2020-04-30 12:43:22 -07:00
Christopher Allford 09df1205de Updated the minimum PHP version to 7.0 2020-04-06 17:07:33 -07:00
Rodrigo Primo 9b73df3bd6 Fix spacing 2019-12-20 12:46:57 -03:00
Rodrigo Primo da139035dd Make phpcs comment more clear 2019-12-20 09:09:14 -03:00
Rodrigo Primo 6734662cbb Improve PHPCS configuration
This commit implements the following changes to PHPCS execution via its configuration file:

- Show progress while it is running
- Improves performance by checking up to 8 files simultaneously
- Display only the relevant bit of filepaths when showing error and warnings
2019-12-18 10:26:36 -03:00
Rodrigo Primo ceaab9fdc0 Bump WP min ver used by PHPCS to match WC current requirement 2019-12-18 10:18:53 -03:00
Claudio Sanches da99bc8ca0 Merge branch 'master' into feature/feature-plugin-packages 2019-07-08 14:33:21 -03:00
Rodrigo Primo 356ad18826
Merge pull request #24003 from woocommerce/remove/apigen
Remove ApiGen
2019-06-28 11:23:36 -03:00
Rodrigo Primo bb78174c33 Remove references to apigen from configuration files
Commit d6bd82865c removed apigen from
WooCommerce core repository as we are moving it to its own repository (https://github.com/woocommerce/woocommerce-api-docs). This
commit removes the apigen from configuration files. In most cases, it is
just removing the apigen directory from the exclude list of things like
PHPCS and Code Climate.
2019-06-28 10:20:30 -03:00
Mike Jolley f8d6b26e2e Add dedicated Packages loader and Autoloader to init functionality 2019-06-25 13:13:04 +01:00
Mike Jolley 06bdfa67fd Include the package autoloader in the main wc file 2019-06-21 13:41:10 +01:00
Gerhard b784de2268 Bump WooCommerce-Sniffs minimum version 2019-06-13 11:47:22 +02:00
Mike Jolley 9d381d456b Remove simplify commerce gateway 2019-01-10 12:01:27 +00:00
Claudio Sanches 9cb219d92b Updated WooCommerce Sniffs to 0.0.3
- Now wp-coding-standards/wpcs and wimg/php-compatibility are dependencies of WooCommerce Sniffs.
- Updated wp-coding-standards/wpcs to 1.1.
- Updated wimg/php-compatibility to 9.0.
2018-11-06 20:58:50 -02:00
Claudio Sanches 61873627a7 Merge branch 'master' into feature/rest-api-v3 2018-09-10 19:16:22 -03:00
Peter Fabian 2f0505a73f Added wc_kses_notice as escaping function to PHPCS. 2018-08-23 14:31:40 +02:00
Claudio Sanches 568f892777 Allow SERVER_REMOTE 2018-07-26 16:31:03 -03:00
Mike Jolley aeb9d3fe65 wc_selected handles escaping 2018-04-24 19:25:20 +01:00
Claudio Sanches 21dc6d28cf
Merge branch 'master' into feature/18477 2018-03-21 14:31:58 -03:00
Claudio Sanches 8a31755b8c Fixed includes/class-wc-session-handler.php PHPCS violations 2018-03-21 00:18:01 -03:00
Claudio Sanches e825f33414 Fixed includes/class-wc-meta-data.php PHPCS violations 2018-03-21 00:11:16 -03:00
Claudio Sanches 47894cc64d Fixed includes/class-wc-checkout.php PHPCS violations 2018-03-16 16:15:08 -03:00
Claudio Sanches 3d4217143e Fixed includes/class-wc-background-emailer.php PHPCS violations 2018-03-15 18:22:12 -03:00
Claudio Sanches 774a54b8ee Deprecated old WC_Geo_IP class 2018-03-15 17:23:40 -03:00
Rodrigo Primo 7b60f55a62 Exclude includes/gateways/simplify-commerce from PHPCS checks
The Simplify Commerce gateway is deprecated since WC 2.6.0 and will be removed in WC 4.0.
2018-03-09 10:48:51 -03:00
Claudio Sanches c7f8e19b0a Ignore legacy directory and deprecated functions 2018-03-07 18:48:56 -03:00
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