Automattic / Automattic/jetpack

Unit Test: WooCommerce 3.3.3 removed webhook factory, breaks Jetpack unit tests

Open
#9,065 1 comment 0 reactions 0 assignees View on GitHub
[Pri] Normal [Status] Bug Scrub [Status] Stale Bug Unit Tests
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### Steps to reproduce the issue

- Set up the /tmp/wordpress-develop test environment
- clone Jetpack into src/wp-content/plugins/jetpack (e.g. today's master)
- clone WooCommerce into src/wp-content/plugins/woocommerce (e.g. today's master)
- attempt to run the phpunit tests ala `JETPACK_TEST_WOOCOMMERCE=1 phpunit`

#### What I expected

- Success

#### What happened instead

```
PHP Warning: require_once(/private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/../../../../woocommerce/tests/framework/factories/class-wc-unit-test-factory-for-webhook.php): failed to open stream: No such file or directory in /private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-woocommerce.php on line 31

Warning: require_once(/private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/../../../../woocommerce/tests/framework/factories/class-wc-unit-test-factory-for-webhook.php): failed to open stream: No such file or directory in /private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-woocommerce.php on line 31
PHP Fatal error: require_once(): Failed opening required '/private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/../../../../woocommerce/tests/framework/factories/class-wc-unit-test-factory-for-webhook.php' (include_path='.:/Users/allendav/pear/share/pear') in /private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-woocommerce.php on line 31

Fatal error: require_once(): Failed opening required '/private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/../../../../woocommerce/tests/framework/factories/class-wc-unit-test-factory-for-webhook.php' (include_path='.:/Users/allendav/pear/share/pear') in /private/tmp/wordpress-develop/src/wp-content/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-woocommerce.php on line 31

```

This is the WooCommerce commit that probably broke Jetpack unit tests: https://github.com/woocommerce/woocommerce/commit/0ac915d0e99fd85f90b90419c06e21870d1d1f0f

Workaround: checkout woocommerce at a slightly older version, e.g. 3.2.0, that still had the old test directory structure, e.g. https://github.com/woocommerce/woocommerce/releases/tag/3.2.0

Contributor guide

Open the contributing guide

Research direction

Start with tests/php/sync/test_class.jetpack-sync-woocommerce.php and reproduce the failure using JETPACK_TEST_WOOCOMMERCE=1 phpunit in the described WordPress test environment. Compare the referenced WooCommerce test layout with the path this test requires; done means the Jetpack WooCommerce unit tests run successfully against the current supported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.