From 254b7c2b86551f7a7e873aebdf06d309442f5dd3 Mon Sep 17 00:00:00 2001 From: Omar Mohamad - El Hassan Lopesino Date: Tue, 7 Nov 2023 12:39:56 +0100 Subject: [PATCH] Entity replacement: Ensure passed tokens contains the correct format --- src/Behat/Context/EntityContext.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Behat/Context/EntityContext.php b/src/Behat/Context/EntityContext.php index 487a4d6..8884e52 100644 --- a/src/Behat/Context/EntityContext.php +++ b/src/Behat/Context/EntityContext.php @@ -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)) {