xwp / wp-dev-lib

DEPRECATED. Common code used during development of WordPress plugins and themes
MIT License
279 stars 65 forks source link

Use newer versions of PHPUnit #300

Closed swissspidy closed 5 years ago

swissspidy commented 5 years ago

WordPress core runs tests using PHPUnit 7, 6, or 4, depending on the PHP version:

https://github.com/WordPress/wordpress-develop/blob/1f1cf751e5130249ee06684399f001ae4479e650/.travis.yml#L62-L82

wp-dev-lib however uses PHPUnit 4 or 5, depending on PHP version:

https://github.com/xwp/wp-dev-lib/blob/d8207e7cf749eaba5de5fb45c49cf7408ba741b6/scripts/travis.install.sh#L11-L16

Is there any chance wp-dev-lib could use more up-to-date PHPUnit versions as well?

kasparsd commented 5 years ago

Could we require users to add the PHPUnit dependency to their project in composer.json instead?

A simple fix would be to check for an existing phpunit executable here before doing any install:

https://github.com/xwp/wp-dev-lib/blob/d8207e7cf749eaba5de5fb45c49cf7408ba741b6/scripts/travis.install.sh#L10

as we do here already:

https://github.com/xwp/wp-dev-lib/blob/90574b4e61c53a9b0e7f286812fe428d13c9ba7d/scripts/check-diff.sh#L454

Thougts?

kasparsd commented 5 years ago

Actually, the whole thing here might no longer be necessary:

https://github.com/xwp/wp-dev-lib/blob/d8207e7cf749eaba5de5fb45c49cf7408ba741b6/scripts/travis.install.sh#L10-L27

since we're already installing PHPunit during install_tools:

https://github.com/xwp/wp-dev-lib/blob/90574b4e61c53a9b0e7f286812fe428d13c9ba7d/scripts/check-diff.sh#L454-L459

which runs right after:

https://github.com/xwp/wp-dev-lib/blob/d8207e7cf749eaba5de5fb45c49cf7408ba741b6/scripts/travis.install.sh#L30

swissspidy commented 5 years ago

@kasparsd Checking for an existing binary from composer makes sense to me. Adding that would be a nice enhancement still.