Skip to content

Commit

Permalink
Merge pull request #304 from wp-cli/fix/phpunit-version-specifics
Browse files Browse the repository at this point in the history
Allow for diverging PHPUnit version specifics in tests
  • Loading branch information
schlessera authored Jan 25, 2022
2 parents 1f289ad + 8bbab06 commit 6d92fb3
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions features/install-wp-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""
And the return code should be 1

@require-php-5.6 @less-than-php-8.0
@less-than-php-8.0
Scenario: Install latest version of WordPress
Given a WP install
And a affirmative-response file:
Expand Down Expand Up @@ -102,7 +102,13 @@ Feature: Scaffold install-wp-tests.sh tests
wp_cli_test_scaffold
"""

When I run `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
When I run `mkdir polyfills && composer init --name=test/package --require="yoast/phpunit-polyfills:^1" --no-interaction --quiet --working-dir=polyfills`
Then the return code should be 0

When I run `composer install --no-interaction --working-dir=polyfills --quiet`
Then the return code should be 0

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`
Then the return code should be 0

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`
Expand Down Expand Up @@ -215,11 +221,25 @@ Feature: Scaffold install-wp-tests.sh tests
wp_cli_test_scaffold
"""
When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
When I run `mkdir polyfills && composer init --name=test/package --require="yoast/phpunit-polyfills:^1" --no-interaction --quiet --working-dir=polyfills`
Then the return code should be 0
When I run `composer install --no-interaction --working-dir=polyfills --quiet`
Then the return code should be 0
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`
Then the return code should be 1
And STDOUT should contain:
"""
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.
Looks like you're using PHPUnit 9.5.
"""
And STDOUT should contain:
"""
WordPress requires at least PHPUnit 5.
"""
And STDOUT should contain:
"""
and is currently only compatible with PHPUnit up to 7.x.
"""
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`
Expand Down

0 comments on commit 6d92fb3

Please sign in to comment.