Skip to content

Commit

Permalink
Entity replacement: Ensure passed tokens contains the correct format
Browse files Browse the repository at this point in the history
  • Loading branch information
omarlopesino authored Nov 7, 2023
1 parent 71bf554 commit 254b7c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Behat/Context/EntityContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ protected function entityTokensReplacements($value) {
foreach ($entity_tokens as $entity_token) {
$token_pieces = explode(':', str_replace(['[', ']'], ['', ''], $entity_token));
array_shift($token_pieces);
if (count($token_pieces) < 4) {
throw new \Exception(sprintf('Missing arguments to find the entity token with name: %s', $entity_token));
}

list($entity_type, $field_key, $field_value, $destiny_replacement) = $token_pieces;

if (!in_array($entity_type, $entity_types)) {
Expand Down

0 comments on commit 254b7c2

Please sign in to comment.