Skip to content

Commit

Permalink
Update changelog, move phpunit-wp-config back to exec
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Jul 8, 2020
1 parent 320e20e commit 8440abc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
5 changes: 5 additions & 0 deletions packages/env/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
### Breaking Changes

- The `config` and `mappings` options in `.wp-env.json` are now merged with any overrides instead of being overwritten.
- The first listed theme is no longer activated when running wp-env start, since this overwrote whatever theme the user manually activated.

### New Feature

- You may now specify specific configuration for different environments using `env.tests` or `env.development` in `.wp-env.json`.

### Bug Fixes

- `wp-env start` performance is now 2x faster after first install.

## 1.6.0-rc.0 (2020-06-24)

- `wp-env destroy` now removes dangling docker volumes and networks associated with the WordPress environment.
Expand Down
27 changes: 18 additions & 9 deletions packages/env/lib/wordpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,6 @@ async function configureWordPress( environment, config, spinner ) {
setupCommands.push( `wp plugin activate ${ pluginSource.basename }` );
}

// Since wp-phpunit loads wp-settings.php at the end of its wp-config.php
// file, we need to avoid loading it too early in our own wp-config.php. If
// we load it too early, then some things (like MULTISITE) will be defined
// before wp-phpunit has a chance to configure them. To avoid this, create a
// copy of wp-config.php for phpunit which doesn't require wp-settings.php.
setupCommands.push(
'sed "/^require.*wp-settings.php/d" /var/www/html/wp-config.php > /var/www/html/phpunit-wp-config.php'
);

if ( config.debug ) {
spinner.info(
`Running the following setup commands on the ${ environment } instance:\n - ${ setupCommands.join(
Expand All @@ -137,6 +128,24 @@ async function configureWordPress( environment, config, spinner ) {
await dockerRun( [ 'bash', '-c', setupCommands.join( ' && ' ) ], {
commandOptions: [ '--rm' ],
} );

// Since wp-phpunit loads wp-settings.php at the end of its wp-config.php
// file, we need to avoid loading it too early in our own wp-config.php. If
// we load it too early, then some things (like MULTISITE) will be defined
// before wp-phpunit has a chance to configure them. To avoid this, create a
// copy of wp-config.php for phpunit which doesn't require wp-settings.php.
await dockerCompose.exec(
environment === 'development' ? 'wordpress' : 'tests-wordpress',
[
'sh',
'-c',
'sed "/^require.*wp-settings.php/d" /var/www/html/wp-config.php > /var/www/html/phpunit-wp-config.php',
],
{
config: config.dockerComposeConfigPath,
log: config.debug,
}
);
}

/**
Expand Down

0 comments on commit 8440abc

Please sign in to comment.