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

WordPress Trac noreply at wordpress.org
Fri Aug 27 16:44:17 UTC 2021


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

 * keywords:  has-patch => has-patch has-testing-instructions


Comment:

 = Testing Scenarios

 In these examples:

 - the `@group formatting` is used to run a smaller sample of tests (i.e.
 to speed up testing):

 {{{
 npm run test:php -- --group formatting
 }}}

 or

 {{{
 npm run test:php-composer -- --group formatting
 }}}

 - the `...` (in the command-line output example)s means more packages are
 `Locking` or `Downloading`. Using this notation for brevity.

 == Scenario 1: Docker not running (or container destroyed) and npm and
 composer packages not installed.

 Assumes Docker is installed locally.

 **Expectations**:
 - Composer package dependencies are installed
 - `composer.lock` file is created
 - Tests run

 **Instructions:**

 Contributor types the following commands into their command-line tool:

 {{{
 npm install
 npm run build:dev
 npm run env:start
 npm run env:install
 }}}

 When running `npm run env:install`, the expected command-line output (or
 similar):

 {{{
 Creating wordpress-develop_cli_run ... done
 Success: Generated 'wp-config.php' file.
 Creating wordpress-develop_cli_run ... done
 Success: Added the constant 'WP_DEBUG' to the 'wp-config.php' file with
 the raw value 'true'.
 Creating wordpress-develop_cli_run ... done
 Success: Added the constant 'WP_DEBUG_LOG' to the 'wp-config.php' file
 with the raw value 'true'.
 Creating wordpress-develop_cli_run ... done
 Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file
 with the raw value 'true'.
 Creating wordpress-develop_cli_run ... done
 Success: Added the constant 'SCRIPT_DEBUG' to the 'wp-config.php' file
 with the raw value 'true'.
 Creating wordpress-develop_cli_run ... done
 Success: Added the constant 'WP_ENVIRONMENT_TYPE' to the 'wp-config.php'
 file with the value 'local'.
 Cloning into 'tests/phpunit/data/plugins/wordpress-importer'...
 Cloning into 'tests/phpunit/data/plugins/wordpress-importer'...
 Creating wordpress-develop_php_run ... done
 Loading composer repositories with package information
 Updating dependencies
 Lock file operations: 41 installs, 0 updates, 0 removals
   - Locking dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
  ...
   - Locking yoast/phpunit-polyfills (1.0.1)
 Writing lock file
 Installing dependencies from lock file (including require-dev)
 Package operations: 41 installs, 0 updates, 0 removals
   - Downloading squizlabs/php_codesniffer (3.6.0)
   ...
   - Downloading phpunit/phpunit (9.5.8)
   - Downloading yoast/phpunit-polyfills (1.0.1)
   0/41 [>---------------------------]   0%
   3/41 [==>-------------------------]   7%
   8/41 [=====>----------------------]  19%
  11/41 [=======>--------------------]  26%
  16/41 [==========>-----------------]  39%
  19/41 [============>---------------]  46%
  22/41 [===============>------------]  53%
  27/41 [==================>---------]  65%
  31/41 [=====================>------]  75%
  35/41 [=======================>----]  85%
  39/41 [==========================>-]  95%
  40/41 [===========================>]  97%
  41/41 [============================] 100%
   - Installing squizlabs/php_codesniffer (3.6.0): Extracting archive
   ...
   - Installing phpunit/phpunit (9.5.8): Extracting archive
   - Installing yoast/phpunit-polyfills (1.0.1): Extracting archive
   0/39 [>---------------------------]   0%
   6/39 [====>-----------------------]  15%
   9/39 [======>---------------------]  23%
  11/39 [=======>--------------------]  28%
  14/39 [==========>-----------------]  35%
  17/39 [============>---------------]  43%
  20/39 [==============>-------------]  51%
  23/39 [================>-----------]  58%
  26/39 [==================>---------]  66%
  29/39 [====================>-------]  74%
  31/39 [======================>-----]  79%
  34/39 [========================>---]  87%
  36/39 [=========================>--]  92%
  37/39 [==========================>-]  94%
  38/39 [===========================>]  97%
  39/39 [============================] 100%
 9 package suggestions were added by new dependencies, use `composer
 suggest` to see details.
 Generating autoload files
 26 packages you are using are looking for funding.
 Use the `composer fund` command to find out more!
 PHP CodeSniffer Config installed_paths set to ../../phpcompatibility/php-
 compatibility,../../phpcompatibility/phpcompatibility-
 paragonie,../../phpcompatibility/phpcompatibility-wp,../../wp-coding-
 standards/wpcs
 Creating wordpress-develop_cli_run ... done
 Success: Database reset.
 Creating wordpress-develop_cli_run ... done
 Success: WordPress installed successfully.
 }}}

 Once completed, the contributor runs the tests:
 {{{
 npm run test:php -- --group formatting
 }}}

 or

 {{{
 npm run test:php-composer -- --group formatting
 }}}

 == Scenario 2: `composer.lock` file is deleted

 The contributor has already run the above commands to setup the local
 testing environment but then deletes the `composer.lock` file.

 **Expectations:**
 - `composer.lock` file is created
 - Tests run

 **Instructions:**

 **Notes for testers**: Run scenario 1 first. Then delete the
 `composer.lock` file.

 Contributor types the following in their command-line tool:
 {{{
 npm run test:php -- --group formatting
 }}}

 or

 {{{
 npm run test:php-composer -- --group formatting
 }}}

 Expected command-line output (or similar):
 {{{
 Creating wordpress-develop_php_run ... done
 Loading composer repositories with package information
 Updating dependencies
 Lock file operations: 41 installs, 0 updates, 0 removals
   - Locking dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
   ...
   - Locking yoast/phpunit-polyfills (1.0.1)
 Writing lock file
 Installing dependencies from lock file (including require-dev)
 Nothing to install, update or remove
 9 package suggestions were added by new dependencies, use `composer
 suggest` to see details.
 Generating autoload files
 26 packages you are using are looking for funding.
 Use the `composer fund` command to find out more!
 Creating wordpress-develop_phpunit_run ... done
 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 7.5.20 by Sebastian Bergmann and contributors.

 .............................................................   61 / 1473
 (  4%)
 ...
 .........                                                     1473 / 1473
 (100%)

 Time: 7.07 seconds, Memory: 128.00 MB
 OK (1473 tests, 2741 assertions)
 }}}

 **Notes for testers**: The PHPUnit version will depend upon your PHP
 version. The `Time` and `Memory` values may be different on your machine.

 == Scenario 3: `vendor` folder is deleted

 The contributor has already run the above commands to setup the local
 testing environment but then deletes the `vendor` folder.

 **Expectations**:
 - Composer package dependencies are installed
 - No changes to the `composer.lock` file
 - Tests run

 **Instructions**

 **Notes for testers**: Same as Scenario 2 but this time delete the
 `vendor` folder.

 Contributor types the following in their command-line tool:
 {{{
 npm run test:php -- --group formatting
 }}}

 or

 {{{
 npm run test:php-composer -- --group formatting
 }}}

 Expected command-line output (or similar):
 {{{
 Creating wordpress-develop_php_run ... done
 Loading composer repositories with package information
 Updating dependencies
 Nothing to modify in lock file
 Installing dependencies from lock file (including require-dev)
 Package operations: 41 installs, 0 updates, 0 removals
   - Downloading squizlabs/php_codesniffer (3.6.0)
   ...
   - Downloading yoast/phpunit-polyfills (1.0.1)
   0/41 [>---------------------------]   0%
   7/41 [====>-----------------------]  17%
   8/41 [=====>----------------------]  19%
  12/41 [========>-------------------]  29%
  16/41 [==========>-----------------]  39%
  23/41 [===============>------------]  56%
  27/41 [==================>---------]  65%
  32/41 [=====================>------]  78%
  37/41 [=========================>--]  90%
  40/41 [===========================>]  97%
  41/41 [============================] 100%
   - Installing squizlabs/php_codesniffer (3.6.0): Extracting archive
   ...
   - Installing yoast/phpunit-polyfills (1.0.1): Extracting archive
   0/39 [>---------------------------]   0%
   6/39 [====>-----------------------]  15%
   9/39 [======>---------------------]  23%
  10/39 [=======>--------------------]  25%
  11/39 [=======>--------------------]  28%
  14/39 [==========>-----------------]  35%
  16/39 [===========>----------------]  41%
  19/39 [=============>--------------]  48%
  22/39 [===============>------------]  56%
  24/39 [=================>----------]  61%
  28/39 [====================>-------]  71%
  32/39 [======================>-----]  82%
  33/39 [=======================>----]  84%
  34/39 [========================>---]  87%
  35/39 [=========================>--]  89%
  36/39 [=========================>--]  92%
  37/39 [==========================>-]  94%
  38/39 [===========================>]  97%
  39/39 [============================] 100%
 Generating autoload files
 26 packages you are using are looking for funding.
 Use the `composer fund` command to find out more!
 PHP CodeSniffer Config installed_paths set to ../../phpcompatibility/php-
 compatibility,../../phpcompatibility/phpcompatibility-
 paragonie,../../phpcompatibility/phpcompatibility-wp,../../wp-coding-
 standards/wpcs
 Creating wordpress-develop_phpunit_run ... done
 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 7.5.20 by Sebastian Bergmann and contributors.

 .............................................................   61 / 1473
 (  4%)
 ...
 .........                                                     1473 / 1473
 (100%)

 Time: 6.64 seconds, Memory: 128.00 MB

 OK (1473 tests, 2741 assertions)
 }}}

 **Notes for testers**: The PHPUnit version will depend upon your PHP
 version. The `Time` and `Memory` values may be different on your machine.

 == Scenario 4: `vendor` folder and `composer.lock` are deleted

 The contributor has already run the above commands to setup the local
 testing environment but then deletes the `vendor` folder and
 `composer.lock` file.

 **Notes for Testers**: Delete both the `vendor` folder and `composer.lock`
 file.

 **Expectations**:
 - Composer package dependencies are installed
 - `composer.lock` file is created
 - Tests run

 **Instructions:**

 **Notes for Testers**: Delete both the `vendor` folder and `composer.lock`
 file.

 Contributor types the following in their command-line tool:
 {{{
 npm run test:php -- --group formatting
 }}}

 or

 {{{
 npm run test:php-composer -- --group formatting
 }}}

 Expected command-line output is similar to Scenario 3.

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


More information about the wp-trac mailing list