openeuropa / oe_testing_utils
Testing utilities for OpenEuropa projects
1.0.0-alpha1
2026-07-27 12:05 UTC
Requires
- php: >=8.3
Requires (Dev)
- composer/installers: ^2.3
- drupal/core: ^10.6 || ^11
- drupal/core-composer-scaffold: ^10.6 || ^11
- drupal/core-dev: ^10.6 || ^11
- ec-europa/toolkit: ^10.23
- openeuropa/code-review: ^2.0.0
This package is auto-updated.
Last update: 2026-07-27 15:28:55 UTC
README
Generic testing utilities for OpenEuropa components.
Installation
The recommended way of installing the package is via Composer:
composer require --dev openeuropa/oe_testing_utils
Usage
CachedDatabaseInstallTrait
Speeds up Drupal functional tests by caching the post-install database state. The first test with a given module/theme/profile fingerprint runs a full site install and dumps the resulting tables to disk. Subsequent tests with the same fingerprint restore the dump instead of running the installer.
Add the trait to your functional test and enable it:
use Drupal\Tests\BrowserTestBase; use OpenEuropa\TestingUtilities\Traits\CachedDatabaseInstallTrait; class MyFunctionalTest extends BrowserTestBase { use CachedDatabaseInstallTrait; /** * {@inheritdoc} */ protected function setUp(): void { $this->cacheDbInstall = TRUE; parent::setUp(); } }
Notes:
- Only the MySQL database driver is supported.
- Dumps are stored in
sites/default/files/functional-test-dumps. Delete this directory to force a fresh install.