Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.php wastes CPU cycles and bandwith downloading PHPUnit every time #67

Open
ottok opened this issue Jun 15, 2018 · 3 comments
Open

Comments

@ottok
Copy link

ottok commented Jun 15, 2018

I noticed that running php test.php downloads PHPUnit on every run, even if phpunit is already in the system and even if phpunit.phar has already been downloaded.

$ phpunit --version
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

$ ll -h /tmp/wp-test-runner/phpunit.phar 
-rw-rw-r-- 1 benchmark benchmark 2.9M Feb  1 07:56 /tmp/wp-test-runner/phpunit.phar

$ php test.php
Environment variables pass checks.
cd '/tmp/wp-test-runner'; php phpunit.phar

PHP version: 7.0.30-1+ubuntu14.04.1+deb.sury.org+1 (/usr/bin/php7.0)

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

.............................................................   61 / 8703 (  0%)
.............................................................  122 / 8703 (  1%)
.............................................................  183 / 8703 (  2%)
.............................................................  244 / 8703 (  2%)
.............................................................  305 / 8703 (  3%)
.............................................................  366 / 8703 (  4%)
.............................................................  427 / 8703 (  4%)
.............................................................  488 / 8703 (  5%)
.............................................................  549 / 8703 (  6%)
.............................................................  610 / 8703 (  7%)
.............................................................  671 / 8703 (  7%)
.............................................................  732 / 8703 (  8%)
.............................................................  793 / 8703 (  9%)
....
@danielbachhuber
Copy link
Member

even if phpunit is already in the system

How would you test to ensure the phpunit installed on the system is of the latest version?

even if phpunit.phar has already been downloaded.

cleanup.php is meant to be run after each test run, which will delete the preparation directory.

@ottok
Copy link
Author

ottok commented Jun 15, 2018

It does not seem to install the latest version now either:

tmp/wp-test-runner$ php phpunit.phar --version
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

How would you test to ensure the phpunit installed on the system is of the latest version?

How do you ensure it now? It does not seem to work?

What if we checked the version of the available system phpunit and if it is below X we proceed to download the phar file? That would avoid both using too old phpunit versions and avoid unnecessary downloads.

@danielbachhuber
Copy link
Member

It does not seem to install the latest version now either:

Good point. We may want to switch to:

➜ wget -O phpunit https://phar.phpunit.de/phpunit-7.phar

How do you ensure it now? It does not seem to work?

The existing download URL is the latest 5.x version.

What if we checked the version of the available system phpunit and if it is below X we proceed to download the phar file? That would avoid both using too old phpunit versions and avoid unnecessary downloads.

I'm not convinced this is something we should optimize for but I'd be open to reviewing a pull request for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants