Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Scope: `ee site create --type=php` and everything php-specific (`src/PHP.php`, `
| `--force` (reset non-empty remote DB) | not covered: dead code today (remote credentials are never checked), needs a reachable remote MariaDB |
| DB name / user collisions on rollback | database.feature: `--dbname`/`--dbuser` of another site refused, colliding default names refused by the volume check, a taken default name gets a `_2` suffix, each on its own sites (regression checks for EasyEngine/site-command#503 and EasyEngine/site-type-php#115) |
| mysql CLI in the php container against the global and local db | not covered yet: the MariaDB client in php8.2+ images demands TLS, which the EasyEngine MariaDB doesn't offer (its 2 scenarios come back with the fix) |
| `--php=<v>` every supported version + `latest` | php-version.feature outline (12 examples, `@slow`) |
| `--php=<v>` every supported version + `latest` (stored as the default version, 8.5) | php-version.feature outline (12 examples, `@slow`) |
| `--php` default 8.5 | create.feature "The site row holds the php defaults", "The compose file ..." |
| `--php` invalid values | create.feature outline "An unsupported --php value is rejected" (4 examples) |
| `--php` loosely matching values (`8`, `7`, `8.40`, `8.4.1`) | not covered: core's synopsis check compares loosely and lets them through (`8.4.1` only on PHP 7), then create() compares as strings and asks whether to continue with the fallback version (8.5, 7.4 or 5.6; `8.4.1` is refused as unsupported). The php type has no `--yes`, so the prompt reads stdin |
Expand Down
30 changes: 15 additions & 15 deletions features/php-version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ Feature: PHP versions of php sites (create --php, update --php)
Scenario Outline: Create a php site on every supported PHP version
When I run "bin/ee site create <site> --type=php --php=<version>"
Then the command should succeed
And the site "<site>" should have the field "php_version" set to "<version>"
And the site "<site>" should have the field "php_version" set to "<stored>"
And the "php" service of site "<site>" should use the pinned "<image>" image
And the php service of site "<site>" should run PHP "<runs>"
And a GET request to "http://<site>/" should return 200
And the response should contain "Congratulations!"
And the file "/opt/easyengine/sites/<site>/config/php/php/conf.d/custom.ini" should contain "<sendmail>"

# "latest" maps to the php8.5 image (Site_PHP_Docker); 8.6 is opt-in.
# "latest" is stored as the default version (8.5) and runs its image; 8.6 is opt-in.
Examples:
| site | version | image | runs | sendmail |
| bh-site-type-php-40.test | 5.6 | easyengine/php5.6 | 5.6 | sendmail_path = /usr/sbin/sendmail -t -i -f no-reply@example.com |
| bh-site-type-php-41.test | 7.0 | easyengine/php7.0 | 7.0 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-42.test | 7.2 | easyengine/php7.2 | 7.2 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-43.test | 7.3 | easyengine/php7.3 | 7.3 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-44.test | 7.4 | easyengine/php7.4 | 7.4 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-45.test | 8.0 | easyengine/php8.0 | 8.0 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-46.test | 8.1 | easyengine/php8.1 | 8.1 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-47.test | 8.2 | easyengine/php8.2 | 8.2 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-48.test | 8.3 | easyengine/php8.3 | 8.3 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-49.test | 8.4 | easyengine/php8.4 | 8.4 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-50.test | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-51.test | latest | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t |
| site | version | stored | image | runs | sendmail |
| bh-site-type-php-40.test | 5.6 | 5.6 | easyengine/php5.6 | 5.6 | sendmail_path = /usr/sbin/sendmail -t -i -f no-reply@example.com |
| bh-site-type-php-41.test | 7.0 | 7.0 | easyengine/php7.0 | 7.0 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-42.test | 7.2 | 7.2 | easyengine/php7.2 | 7.2 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-43.test | 7.3 | 7.3 | easyengine/php7.3 | 7.3 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-44.test | 7.4 | 7.4 | easyengine/php7.4 | 7.4 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-45.test | 8.0 | 8.0 | easyengine/php8.0 | 8.0 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-46.test | 8.1 | 8.1 | easyengine/php8.1 | 8.1 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-47.test | 8.2 | 8.2 | easyengine/php8.2 | 8.2 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-48.test | 8.3 | 8.3 | easyengine/php8.3 | 8.3 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-49.test | 8.4 | 8.4 | easyengine/php8.4 | 8.4 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-50.test | 8.5 | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t |
| bh-site-type-php-51.test | latest | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t |

Scenario: Update the PHP version of a php site and keep custom php settings
Given a php site "bh-site-type-php-52.test" exists
Expand Down
4 changes: 4 additions & 0 deletions src/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ public function create( $args, $assoc_args ) {
}
\EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ) );
}
// Stored as the concrete version: a stored `latest` would move to a newer image on a later default bump and keep the old PHP config.
if ( 'latest' === $this->site_data['php_version'] ) {
$this->site_data['php_version'] = self::DEFAULT_PHP_VERSION;
}

\EE\Site\Utils\check_site_name_conflicts( $this->site_data['site_url'], $this->site_data['site_fs_path'] );

Expand Down