[wp-trac] [WordPress Trac] #53945: Local test workflow changes for installing Composer dependencies

WordPress Trac noreply at wordpress.org
Wed Sep 1 23:22:49 UTC 2021


#53945: Local test workflow changes for installing Composer dependencies
------------------------------------------------+--------------------------
 Reporter:  hellofromTonya                      |       Owner:  johnbillion
     Type:  task (blessed)                      |      Status:  reopened
 Priority:  normal                              |   Milestone:  5.9
Component:  Build/Test Tools                    |     Version:
 Severity:  normal                              |  Resolution:
 Keywords:  has-patch has-testing-instructions  |     Focuses:
------------------------------------------------+--------------------------

Comment (by hellofromTonya):

 Replying to [comment:27 jrf]:
 >* Would work only if someone uses the PHPUnit PHAR / `test:php` command
 to run the tests. In that case, `composer update` is run as part of the
 `test:php` command and would install/update the PHPUnit Polyfills (if
 necessary). The PHPUnit version installed is not (well, barely) relevant
 in that case as the Docker image will use the appropriate PHAR for the
 chosen PHP image.

 I think the disconnect is this: the recommended command for running tests
 locally is `npm run test:php`, not `npm run test:php-composer`. This works
 for those using npm/Docker workflow too.

 Here is where it's recommended:

 - [https://github.com/wordpress/wordpress-develop#to-run-the-tests In the
 testing section of the `README.md`]:
 >To run the tests
 >These commands run the PHP and end-to-end test suites, respectively:
 >
 >`npm run test:php`
 >`npm run test:e2e`

 - [https://make.wordpress.org/core/handbook/testing/automated-
 testing/phpunit/#setting-up-the-docker-container-environment in the
 PHPUnit section of the handbook]:

 >Running the tests
 >
 >Once the docker container is set up and provisioned, you can run the
 tests from the command-line: `npm run test:php`.

 There is a [https://make.wordpress.org/core/2020/11/23/wordpress-and-
 php-8-0/ note in this post] about the intended differences between these 2
 commands:
 {{{
 // Run within the local Docker container using version of
 // PHPUnit installed within the container.
 npm run test:php

 // Run within the local Docker container using version of
 // PHPUnit installed via Composer.
 npm run test:php-composer
 }}}

 However, we've changed this as the PHPUnit phar is no longer loaded in the
 container and instead is installed via Composer.

 So I'm thinking `test:php-composer` command is for the CI or for those
 contributors who don't want to install Composer or have it installed
 globally somewhere.

 Replying to [comment:27 jrf]:
 > There also seems to be a misconception: "Running the `composer
 update/install` command would slow down the general install".
 > While this is true in a situation when an install/update is actually
 needed (mismatch between the versions installed and the current PHP
 version), if there is no version mismatch, the command will just say
 "nothing to update" and move on, so for ''most'' users, the slowdown would
 barely be noticeable.

 The time it takes depends upon a contributor's internet download speed as
 well as if there are any blips in the connectivity chain. While for many,
 it may be super duper fast, there is a potential for some contributors
 that it slows them down.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53945#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list