diff --git a/.editorconfig b/.editorconfig index c394f5014f27a47bd99ee010987ad626ae7e31c8..d33d6095f6e52bfdc9aff3305a07f9847a1c2888 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,19 +4,86 @@ # WordPress Coding Standards # https://make.wordpress.org/core/handbook/coding-standards/ +# Configuration for PhpStorm + root = true [*] -indent_style = space -indent_size = 4 charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +indent_style = tab +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 4 + +[*.scss] +ij_scss_enforce_quotes_on_format = true +ij_scss_hex_color_long_format = true +ij_scss_hex_color_lower_case = true + +[{*.cjs,*.js}] +ij_javascript_do_while_brace_force = always +ij_javascript_if_brace_force = always +ij_javascript_import_sort_module_name = true +ij_javascript_reformat_c_style_comments = true +ij_javascript_space_after_unary_not = true +ij_javascript_space_before_unary_not = true +ij_javascript_spaces_within_array_initializer_brackets = true +ij_javascript_spaces_within_brackets = true +ij_javascript_spaces_within_catch_parentheses = true +ij_javascript_spaces_within_for_parentheses = true +ij_javascript_spaces_within_if_parentheses = true +ij_javascript_spaces_within_imports = true +ij_javascript_spaces_within_interpolation_expressions = true +ij_javascript_spaces_within_method_call_parentheses = true +ij_javascript_spaces_within_method_parentheses = true +ij_javascript_spaces_within_object_literal_braces = true +ij_javascript_spaces_within_parentheses = true +ij_javascript_spaces_within_switch_parentheses = true +ij_javascript_spaces_within_while_parentheses = true +ij_javascript_while_brace_force = always -[*.yml] -indent_style = space -indent_size = 2 +[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}] +ij_php_align_assignments = true +ij_php_align_class_constants = true +ij_php_align_key_value_pairs = true +ij_php_align_phpdoc_comments = true +ij_php_align_phpdoc_param_names = true +ij_php_class_brace_style = end_of_line +ij_php_comma_after_last_array_element = true +ij_php_else_if_style = combine +ij_php_force_short_declaration_array_style = true +ij_php_getters_setters_naming_style = snake_case +ij_php_if_brace_force = always +ij_php_lower_case_boolean_const = true +ij_php_lower_case_null_const = true +ij_php_method_brace_style = end_of_line +ij_php_phpdoc_blank_line_before_tags = true +ij_php_phpdoc_blank_lines_around_parameters = true +ij_php_phpdoc_keep_blank_lines = false +ij_php_phpdoc_wrap_long_lines = true +ij_php_space_after_type_cast = true +ij_php_space_after_unary_not = true +ij_php_space_before_unary_not = true +ij_php_spaces_around_var_within_brackets = true +ij_php_spaces_within_array_initializer_braces = true +ij_php_spaces_within_catch_parentheses = true +ij_php_spaces_within_for_parentheses = true +ij_php_spaces_within_if_parentheses = true +ij_php_spaces_within_method_call_parentheses = true +ij_php_spaces_within_method_parentheses = true +ij_php_spaces_within_parentheses = true +ij_php_spaces_within_switch_parentheses = true +ij_php_spaces_within_while_parentheses = true +ij_php_ternary_operation_signs_on_next_line = true +ij_php_variable_naming_style = snake_case -[*.md] -trim_trailing_whitespace = false +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = div,p,a +ij_html_align_attributes = false +ij_html_do_not_indent_children_of_tags = html,thead,tbody,tfoot +ij_html_new_line_after_last_attribute = when multiline +ij_html_space_inside_empty_tag = true +ij_html_uniform_ident = true diff --git a/.gitattributes b/.gitattributes index 6b71fc789360605b77f8f82161887ac88953f392..f6f424c34e253c9d76a465c26d1a5184733af05c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,7 +6,4 @@ vendor/ export-ignore .gitignore export-ignore .gitlab-ci.yml export-ignore .idea export-ignore -apigen.neon export-ignore phpcs.xml.dist export-ignore -phpunit-integration.xml export-ignore -phpunit-unit.xml export-ignore diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 7d4108a123dd5ce0e9b9447dd5e86af66ebfe8d8..0000000000000000000000000000000000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,8 +0,0 @@ -variables: - DISABLE_PHP_5_5: 1 - DISABLE_UNIT: 1 - DISABLE_INTEGRATION_TESTS: 1 - DISABLE_CODECEPTION: 1 - IS_LIBRARY: 1 - -include: 'https://gitlab.com/wpdesk/gitlab-ci/raw/master/gitlab-ci-1.2.yml' diff --git a/CHANGELOG.md b/CHANGELOG.md index c40bf653ae770f6961fadd9e0b284372b63267a1..de0b34520b511554870c48f59fd2ea2504e4920d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,22 @@ +# Changelog + +## [1.2.0] - 2021-06-14 +### Changed +- Fully rewritten CS rules to adhere developers needs +- Enhanced .editorconfig to work seamlessly with PhpStorm + +### Removed +- Unnecessary files and folders belonging to other project + ## [1.1.0] - 2021-05-21 -## Added +### Added - Support for Composer 2 - Support for PHP 8 ## [1.0.1] - 2019-05-30 -## Added +### Added * classes directory in rules ## [1.0.0] - 2019-05-30 -## Added +### Added * First version diff --git a/README.md b/README.md index 9699beb42cbc1e9b163aebc922b5f449cb46355a..671c007bd8256d0c861f578fc7d55f2896a9eac6 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,19 @@ -[](https://gitlab.com/wpdesk/wp-code-sniffer/pipelines) -[](https://gitlab.com/wpdesk/wp-code-sniffer/commits/master) -[](https://packagist.org/packages/wpdesk/wp-code-sniffer) -[](https://packagist.org/packages/wpdesk/wp-code-sniffer) -[](https://packagist.org/packages/wpdesk/wp-code-sniffer) -[](https://packagist.org/packages/wpdesk/wp-code-sniffer) +# WP Desk Coding Standards +Set of general WordPress standards enhanced by WP Desk coding style. -Library for Wp Desk Coding Standards in plugins. -=============================================== +## Installation & Usage -# Installation +To install this set of standards simply add the library to your require-dev in `composer.json` or run: `composer require --dev wpdesk/wp-code-sniffer` -# Usage +Copy `phpcs.xml.dist` and `.editorconfig` to your project folder, then set needed config like `text_domain`, etc. -Copy `phpcs.xml.dist` file to plugin root directory. Change `enter-plugin-text-domain-here` to plugin text domain. +## Integration with PHP Storm -# PHP Storm +Go to *Settings→Languages & Frameworks→PHP→Quality Tools* in PHP_CodeSniffer select *Local* in Configuration. -Goto Settings->Languages & Frameworks->PHP->Quality Tools, in PHP_Codesniffer select Local in Configuration. Click `...` and empty path. Click OK. -Next open composer.json file and click `Update` (on top of file). \ No newline at end of file +You can also select more settings by clicking `...`. Clear the path or set it to globally installed `phpcs` if you have locally installed dependencies. + +Secondly, in *Settings→Inspections→Quality Tools* check the box **PHP_CodeSniffer inspections** and set coding standards to custom path pointing to your `phpcs.xml.dist` file. diff --git a/WPDeskPlugin/ruleset.xml b/WPDeskPlugin/ruleset.xml index 8bf0361db1908740edf6e911bb1728c858906f19..46cbd2f90a2f2cb932327d1b05cb69818a39fd01 100644 --- a/WPDeskPlugin/ruleset.xml +++ b/WPDeskPlugin/ruleset.xml @@ -1,31 +1,159 @@ <?xml version="1.0"?> -<ruleset name="WPDeskPlugin"> +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WPDeskPlugin"> + <description>Sniffs for WordPress WPDesk plugins</description> - <config name="testVersion" value="5.6-"/> + <!-- Always exclude all files in version management related directories. --> + <exclude-pattern>*/.git/*</exclude-pattern> + <exclude-pattern>*/.wordpress-svn/*</exclude-pattern> + + <!-- Always exclude all files in dependency related directories. --> + <exclude-pattern>*/node_modules/*</exclude-pattern> + <exclude-pattern>*/vendor(_prefixed)?/*</exclude-pattern> + + <!-- Always exclude all tests. Differences between PHPUnit, mocking libraries and WPCS make it hard to enforce some CS. --> + <exclude-pattern>*/tests/*</exclude-pattern> + + <exclude-pattern>scoper\.inc\.php$</exclude-pattern> + + <rule ref="WordPress"> + <!-- Follow PSR-4 for autoloading naming convention --> + <exclude name="WordPress.Files.FileName"/> - <arg name="extensions" value="php"/> + <!-- WPCS demands long arrays. WPDeskCS demands short arrays. --> + <exclude name="Generic.Arrays.DisallowShortArraySyntax"/> - <exclude-pattern>tests/*</exclude-pattern> - <exclude-pattern>scoper.inc.php</exclude-pattern> + <!-- Demanding Yoda conditions is stupid. --> + <exclude name="WordPress.PHP.YodaConditions"/> - <rule ref="PHPCompatibility"/> - <rule ref="WordPress"/> + <!-- The only required comments are for the classes. --> + <exclude name="Squiz.Commenting.FunctionComment"/> + <exclude name="Generic.Commenting.DocComment.MissingShort"/> - <!-- Remove checking if classes are in class- files --> - <rule ref="WordPress.Files.FileName"> - <exclude-pattern>/class*/.*\.php</exclude-pattern> + <!-- You can use short if-else form. --> + <exclude name="WordPress.PHP.DisallowShortTernary"/> + + <!-- If a conscious choice has been made for a non-strict comparison, that's ok. + I.e. when `strict` has been explicitly set to `false` in an array comparison, + it will be allowed. --> + <exclude name="WordPress.PHP.StrictInArray.FoundNonStrictFalse"/> + + <exclude name="WordPress.WP.AlternativeFunctions" /> + + <!-- Sometimes it's better not to use user's timezone. --> + <exclude name="WordPress.DateTime.RestrictedFunctions.date_date" /> </rule> - <rule ref="WordPress.Files.FileName.InvalidClassFileName"> - <exclude-pattern>/class*/.*\.php</exclude-pattern> - </rule> + <!-- Allow slash in hook name. --> + <rule ref="WordPress.NamingConventions.ValidHookName"> + <properties> + <property name="additionalWordDelimiters" value="/"/> + </properties> + </rule> + + <!-- Template files should have comment with passed variables. --> + <rule ref="Squiz.Commenting.FileComment"> + <include-pattern>*/templates/*</include-pattern> + <exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/> + </rule> - <rule ref="WordPress.NamingConventions.ValidVariableName"> - <exclude-pattern>/class*/.*\.php</exclude-pattern> + <rule ref="WordPress.Arrays.MultipleStatementAlignment"> + <type>error</type> + <properties> + <!-- No need to adjust alignment of large arrays when the item with the largest key is removed. --> + <property name="exact" value="false"/> + <!-- Don't align multi-line items if ALL items in the array are multi-line. --> + <property name="alignMultilineItems" value="!=100"/> + <!-- Array Assignment operator should always be on the same line as the array key. --> + <property name="ignoreNewlines" value="false"/> + </properties> </rule> - <rule ref="Generic.Commenting.DocComment.MissingShort"> - <exclude-pattern>\.php</exclude-pattern> + <!-- In contrast to WPCS: demand short arrays. --> + <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> + + <!-- Check the complexity of code in advance to prevent too complex structures. --> + <rule ref="Generic.Metrics.CyclomaticComplexity"> + <properties> + <property name="complexity" value="15"/> + <property name="absoluteComplexity" value="30"/> + </properties> + </rule> + + <rule ref="Generic.Metrics.NestingLevel"> + <properties> + <property name="nestingLevel" value="6" /> + <property name="absoluteNestingLevel" value="10" /> + </properties> + </rule> + + <rule ref="PHPCompatibilityWP"> + <include-pattern>*\.php$</include-pattern> + </rule> + <!-- + ############################################################################# + ADD SOME SPECIFIC EXTRA SNIFFS + These may make it into WPCS at some point. If so, they can be removed here. + ############################################################################# + --> + <!-- Error prevention: Make sure the condition in a inline if declaration is bracketed. --> + <rule ref="Squiz.ControlStructures.InlineIfDeclaration"/> + + <!-- Error prevention: Make sure arithmetics are bracketed. --> + <rule ref="Squiz.Formatting.OperatorBracket.MissingBrackets"/> + + <!-- CS: no blank line between the content of a function and a function close brace.--> + <rule ref="PSR2.Methods.FunctionClosingBrace"/> + + <!-- CS: ensure exactly one blank line before each property declaration. --> + <rule ref="Squiz.WhiteSpace.MemberVarSpacing"/> + + <!-- CS: don't allow "// end class" comments and the likes. --> + <rule ref="PSR12.Classes.ClosingBrace"/> + + <!-- CS: enforce consistent indentation of chained object method calls. --> + <rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"> + <properties> + <property name="multilevel" value="true"/> + </properties> + </rule> + + <!-- Error prevention: Ensure no git conflicts make it into the code base. --> + <!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset. + Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1500 --> + <rule ref="Generic.VersionControl.GitMergeConflict"/> + + <!-- CS: no space between an increment/decrement operator and the variable it applies to. --> + <!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset. + Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1511 --> + <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/> + + <!-- QA: Function declarations should not contain parameters which will never be used. --> + <!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset. + Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1510 --> + <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.Found"/> + <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed"/> + + <!-- CS: Ensure consistent whitespace around spread operators. --> + <!-- PHPCS 3.5.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset. + Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1762 --> + <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/> + + <!-- CS: Disallow a leading backslash at the start of an import use statement. --> + <!-- PHPCS 3.5.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. --> + <rule ref="PSR12.Files.ImportStatement"/> + + <!-- CS: Enforces that a PHP open tag is on a line by itself when used at the start of a PHP-only file. --> + <!-- PHPCS 3.5.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. --> + <rule ref="PSR12.Files.OpenTag"/> + + <!-- ##### Documentation Sniffs vs empty index files ##### --> + + <!-- Exclude the 'empty' index files from some documentation checks --> + <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore"> + <exclude-pattern>*/index\.php$</exclude-pattern> </rule> + <rule ref="Squiz.Commenting.FileComment.WrongStyle"> + <exclude-pattern>*/index\.php$</exclude-pattern> + </rule> </ruleset> diff --git a/apigen.neon b/apigen.neon deleted file mode 100644 index 1aec8cf79a0fc4b0035465c5e90d65b85b3449e7..0000000000000000000000000000000000000000 --- a/apigen.neon +++ /dev/null @@ -1,27 +0,0 @@ -destination: docs -templateConfig: /app/theme-woocommerce/config.neon -extensions: [php] -source: - - src -exclude: - - vendor - - tests - - languages - -charset: [UTF-8] -main: Wordpress plugin -title: Plugin template more info -baseUrl: "/" - -templateTheme: default -php: false -sourceCode: false -tree: true -deprecated: false -todo: false -download: false - -accessLevels: - - public - - private - - protected diff --git a/composer.json b/composer.json index 3682b7d778db5260bcdda5542219a6cb05be79f2..0c1175034a91c819502c5244b581b1264c63a11a 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,12 @@ { "name": "wpdesk/wp-code-sniffer", - "description": "Library for WP Desk Coding standards in plugins.", + "description": "Library for WP Desk Coding Standards in plugins.", "license": "MIT", - "keywords": ["wordpress", "code sniffer", "admin"], + "keywords": ["wordpress", "code sniffer", "admin", "phpcs"], "homepage": "https://gitlab.com/wpdesk/wp-code-sniffer", "type": "phpcodesniffer-standard", "prefer-stable": true, + "version": "1.2.0", "authors": [ { "name": "grola", @@ -13,24 +14,24 @@ } ], "require": { + "php": ">=7.0", "dealerdirect/phpcodesniffer-composer-installer": "0.6|^0.7", - "phpcompatibility/php-compatibility": "^9.3", - "squizlabs/php_codesniffer": "^3.5", - "wp-coding-standards/wpcs": "^2.2" - }, - "require-dev": { - "phpunit/phpunit": "<7", - "mockery/mockery": "*", - "10up/wp_mock": "*" - }, - "autoload": { - }, - "autoload-dev": { + "squizlabs/php_codesniffer": "^3.6", + "wp-coding-standards/wpcs": "^2.3", + "phpcompatibility/phpcompatibility-wp": "^2.1.1" }, + "require-dev": { + "roave/security-advisories": "dev-latest" + }, "scripts": { - "phpcs": "phpcs" - }, - "extra": { - "class": "WPDesk\\Composer\\Codeception\\Plugin" + "install-codestandards" : [ + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run" + ], + "pre-package-install": [ + "@install-codestandards" + ], + "post-package-update": [ + "@install-codestandards" + ] } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 3a67263cb04100b4ab816da142dfc9294f5a9f3c..601f1d76b84375b40560545a9fbc4d9faf8d3060 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,10 +1,43 @@ <?xml version="1.0"?> <ruleset name="WordPress Coding Standards for WP Desk Plugin"> + <!-- + ############################################################################# + COMMAND LINE ARGUMENTS + https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml + ############################################################################# + --> + + <!-- Scan all files. --> + <file>./src</file> + <file>./templates</file> + + <!-- Only check PHP files. --> + <arg name="extensions" value="php"/> + + <!-- Show progress, show the error codes for each message (source). --> + <arg value="sp"/> + + <!-- Check up to 8 files simultaneously. --> + <arg name="parallel" value="8"/> + + <!-- Cache outcomes for better performance. Remember to add the file to .gitignore. --> + <arg name="cache" value="./.phpcs-cache"/> + + <!-- + ############################################################################# + USE THE WPDeskCS RULESET + ############################################################################# + --> + + <!-- Define plugin text domain for i18n. --> <config name="text_domain" value="enter-plugin-text-domain-here"/> - <exclude-pattern>tests/*</exclude-pattern> - <exclude-pattern>scoper.inc.php</exclude-pattern> + <!-- This value should be aligned with WordPress support version declared in plugin header --> + <config name="minimum_supported_wp_version" value="5.0"/> + + <!-- Set value aligned with supported PHP Version for PHPCompatibilityWP check. --> + <config name="testVersion" value="7.0-"/> <rule ref="WPDeskPlugin"/> diff --git a/phpunit-integration.xml b/phpunit-integration.xml deleted file mode 100644 index 634b884c1c32948885c7e1ff159b3531e235d298..0000000000000000000000000000000000000000 --- a/phpunit-integration.xml +++ /dev/null @@ -1,34 +0,0 @@ -<phpunit bootstrap="tests/integration/bootstrap.php" - backupGlobals="false" -> - <testsuites> - <testsuite> - <directory prefix="Test" suffix=".php">./tests/integration</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory suffix=".php">src</directory> - <exclude> - <file>src/init.php</file> - <directory>src/assets</directory> - <directory suffix=".php">tests</directory> - <directory suffix=".php">vendor</directory> - </exclude> - </whitelist> - </filter> - - <logging> - <log type="junit" target="build-coverage/report.junit.xml"/> - <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/> - <log type="coverage-text" target="build-coverage/coverage.txt"/> - <log type="coverage-clover" target="build-coverage/clover.xml"/> - </logging> - - <php> - <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/> - <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/> - </php> - -</phpunit> diff --git a/phpunit-unit.xml b/phpunit-unit.xml deleted file mode 100644 index 06391cd41721311f1bae1e3fe1a60977b932a94a..0000000000000000000000000000000000000000 --- a/phpunit-unit.xml +++ /dev/null @@ -1,21 +0,0 @@ -<phpunit bootstrap="tests/unit/bootstrap.php"> - <testsuites> - <testsuite> - <directory prefix="test-" suffix=".php">./tests/unit/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory suffix=".php">src</directory> - </whitelist> - </filter> - - <logging> - <log type="junit" target="build-coverage/report.junit.xml"/> - <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/> - <log type="coverage-text" target="build-coverage/coverage.txt"/> - <log type="coverage-clover" target="build-coverage/clover.xml"/> - </logging> - -</phpunit> diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php deleted file mode 100644 index 35315e4a86b379cf1bf6306ecb8de2a73fc641f3..0000000000000000000000000000000000000000 --- a/tests/integration/bootstrap.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL); -ini_set('display_errors', '1'); -ini_set('display_startup_errors', '1'); - -// disable xdebug backtrace -if ( function_exists( 'xdebug_disable' ) ) { - xdebug_disable(); -} - -if ( getenv( 'PLUGIN_PATH' ) !== false ) { - define( 'PLUGIN_PATH', getenv( 'PLUGIN_PATH' ) ); -} else { - define( 'PLUGIN_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR ); -} - -require_once( getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/functions.php' ); - -tests_add_filter( 'muplugins_loaded', function () { - require PLUGIN_PATH . '/woocommerce-fakturownia.php'; - $plugins_to_active[] = 'woocommerce-fakturownia/woocommerce-fakturownia.php'; - update_option( 'active_plugins', $plugins_to_active ); -}, 100 ); - -putenv('WP_TESTS_DIR=' . getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit'); -require_once( getenv( 'WC_DEVELOP_DIR' ) . '/tests/bootstrap.php' ); - -$plugins_to_active = get_option( 'active_plugins' ); -$plugins_to_active[] = 'woocommerce/woocommerce.php'; -update_option( 'active_plugins', $plugins_to_active ); - -do_action('plugins_loaded'); - -echo "\n\n"; -echo 'WC_VERSION=' . WC_VERSION . "\n"; -echo 'PHP_VERSION=' . phpversion() . "\n"; -echo "\n\n"; diff --git a/tests/unit/bootstrap.php b/tests/unit/bootstrap.php deleted file mode 100644 index e55059f69f9265d81aa3a4afa8c679633a5a6ad9..0000000000000000000000000000000000000000 --- a/tests/unit/bootstrap.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * PHPUnit bootstrap file - */ - -require_once __DIR__ . '/../../vendor/autoload.php'; - -error_reporting( E_ALL ); - -if ( getenv( 'PLUGIN_PATH' ) !== false ) { - define( 'PLUGIN_PATH', getenv( 'PLUGIN_PATH' ) ); -} else { - define( 'PLUGIN_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR ); -} - -if ( getenv( 'ABSPATH' ) !== false ) { - define( 'ABSPATH', getenv( 'ABSPATH' ) ); -} else { - define( 'ABSPATH', PLUGIN_PATH . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR ); -} - -WP_Mock::setUsePatchwork( true ); -WP_Mock::bootstrap();