[wp-trac] [WordPress Trac] #46815: Add PHPUnit setup to composer.json

WordPress Trac noreply at wordpress.org
Sat Apr 6 17:14:35 UTC 2019


#46815: Add PHPUnit setup to composer.json
------------------------------------+---------------------
 Reporter:  welcher                 |       Owner:  (none)
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  5.3
Component:  Build/Test Tools        |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+---------------------

Comment (by ayeshrajans):

 I always wondered why we don't use the `composer.json` file to install
 PHPUnit, but have a complex switch/case matrix in `.travis.yml` with
 `composer install phpunit/phpunit` calls.

  - Because we use different phpunit versions for each PHP version, we
 cannot use the same `composer.lock` file. When `composer install` is run,
 composer will install the exact list of packages regardless of the
 platform PHP version. As a solution, we can remove shipping our
 `composer.lock` file. PHPUnit promptly follows server, and we shouldn't be
 afraid of minor updates.

  - With the `.travis.yml`, PHPUnit is installed globally. If we were to
 regular composer require-dev, we will now need to update all PHPUnit
 invocations to use the `vendor/bin/phpunit` path because IIRC, Travis
 images already have PHPUnit installed.

  - This will require us to update the `Gruntfile.js` to use the new
 `vendor/bin/phpunit` executable instead of the global one.

 I understand why whoever decided to use `composer install` in the Travis
 to install phpunit, but with WordPress dropping PHP 5.2 (so we will always
 have composer)` I think it's a good time to finally clean up and fix.

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


More information about the wp-trac mailing list