Automattic / Automattic/media-explorer
Migrate CI integration tests from SVN-based setup to wp-env
- Dominant language
- PHP
- Stars
- 123
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
The current GitHub Actions workflow for integration tests uses an SVN-based setup (`composer prepare-ci` / `bin/install-wp-tests.sh`) to download WordPress test files. Starting with ubuntu-22.04 (and ubuntu-latest which now points to ubuntu-24.04), **Subversion is no longer pre-installed** on GitHub Actions runners.
This causes the workflow to fail with:
```
svn: command not found
```
## Proposed Solution
Migrate to `@wordpress/env` (wp-env) for running integration tests. This aligns with our plugin standards and provides several benefits:
**Why wp-env instead of adding SVN?**
- **Consistency**: Same environment for local development and CI
- **No SVN dependency**: Eliminates reliance on legacy tooling
- **Better isolation**: Docker-based environment
- **Faster startup**: Cached Docker images
- **Standard approach**: Matches WordPress core/Gutenberg practices and other plugins in this org (e.g., ad-code-manager, liveblog)
## Implementation Steps
1. [ ] Ensure `.wp-env.json` exists and is correctly configured
2. [ ] Update `.github/workflows/integrations.yml` to use wp-env pattern:
```yaml
- name: Install wordpress environment
run: npm install -g @wordpress/env
- name: Setup wp-env
run: wp-env start
env:
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wordpress }}
- name: Run integration tests (single site)
run: composer test:integration
- name: Run integration tests (multisite)
run: composer test:integration-ms
```
3. [ ] Update `composer.json` scripts to run tests via wp-env:
```json
{
"scripts": {
"test:integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/media-explorer ./vendor/bin/phpunit --testsuite integration",
"test:integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/media-explorer /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit --testsuite integration'"
}
}
```
4. [ ] Update `tests/bootstrap.php` if needed to work with wp-env's test environment
5. [ ] Remove legacy `bin/install-wp-tests.sh` and related `composer prepare-ci` script if no longer needed
6. [ ] Verify tests pass locally and in CI
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.