Skip to content

Commit 6d92fb3

Browse files
authored
Merge pull request #304 from wp-cli/fix/phpunit-version-specifics
Allow for diverging PHPUnit version specifics in tests
2 parents 1f289ad + 8bbab06 commit 6d92fb3

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

features/install-wp-tests.feature

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Feature: Scaffold install-wp-tests.sh tests
1414
"""
1515
And the return code should be 1
1616

17-
@require-php-5.6 @less-than-php-8.0
17+
@less-than-php-8.0
1818
Scenario: Install latest version of WordPress
1919
Given a WP install
2020
And a affirmative-response file:
@@ -102,7 +102,13 @@ Feature: Scaffold install-wp-tests.sh tests
102102
wp_cli_test_scaffold
103103
"""
104104

105-
When I run `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
105+
When I run `mkdir polyfills && composer init --name=test/package --require="yoast/phpunit-polyfills:^1" --no-interaction --quiet --working-dir=polyfills`
106+
Then the return code should be 0
107+
108+
When I run `composer install --no-interaction --working-dir=polyfills --quiet`
109+
Then the return code should be 0
110+
111+
When I run `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_TESTS_PHPUNIT_POLYFILLS_PATH={RUN_DIR}/polyfills/vendor/yoast/phpunit-polyfills ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
106112
Then the return code should be 0
107113

108114
When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest < affirmative-response`
@@ -215,11 +221,25 @@ Feature: Scaffold install-wp-tests.sh tests
215221
wp_cli_test_scaffold
216222
"""
217223
218-
When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
224+
When I run `mkdir polyfills && composer init --name=test/package --require="yoast/phpunit-polyfills:^1" --no-interaction --quiet --working-dir=polyfills`
225+
Then the return code should be 0
226+
227+
When I run `composer install --no-interaction --working-dir=polyfills --quiet`
228+
Then the return code should be 0
229+
230+
When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_TESTS_PHPUNIT_POLYFILLS_PATH={RUN_DIR}/polyfills/vendor/yoast/phpunit-polyfills ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
219231
Then the return code should be 1
220232
And STDOUT should contain:
221233
"""
222-
Looks like you're using PHPUnit 9.5.8. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.
234+
Looks like you're using PHPUnit 9.5.
235+
"""
236+
And STDOUT should contain:
237+
"""
238+
WordPress requires at least PHPUnit 5.
239+
"""
240+
And STDOUT should contain:
241+
"""
242+
and is currently only compatible with PHPUnit up to 7.x.
223243
"""
224244
225245
When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest < affirmative-response`

0 commit comments

Comments
 (0)