Skip to content

Commit

Permalink
use both trait conditionnaly EntityReferenceTestTrait and EntityRefer…
Browse files Browse the repository at this point in the history
…enceFieldCreationTrait for Drupal 10 & 11 compliances
  • Loading branch information
WengerK committed Jul 31, 2024
1 parent eb56639 commit 0057c3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- add getRequestStack & getTitleResolver to TwigExtensionBase
- improve type-hinting using RevisionableStorageInterface for Loader::loadEntityRevision && Render::renderEntityRevision
- remove usage of deprecated twig_date_converter function when Twig 3.9 is installed
- use both trait conditionnaly EntityReferenceTestTrait and EntityReferenceFieldCreationTrait for Drupal 10 & 11 compliances

### Fixed
- fix tests running on 10.3-dev with rendered webp image
Expand Down
10 changes: 8 additions & 2 deletions tests/src/Functional/BambooTwigTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;

// Workaround to support tests against both Drupal 10.1 and Drupal 11.0.
// @todo Remove once we depend on Drupal 10.2.
if (!trait_exists(EntityReferenceFieldCreationTrait::class)) {
class_alias('\Drupal\Tests\field\Traits\EntityReferenceTestTrait', EntityReferenceFieldCreationTrait::class);
}

/**
* Has some additional helper methods to make test code more readable.
*/
abstract class BambooTwigTestBase extends BrowserTestBase {
use EntityReferenceTestTrait;
use EntityReferenceFieldCreationTrait;

/**
* The Entity Type Manager.
Expand Down

0 comments on commit 0057c3e

Please sign in to comment.