Skip to content

Commit 254b7c2

Browse files
authored
Entity replacement: Ensure passed tokens contains the correct format
1 parent 71bf554 commit 254b7c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Behat/Context/EntityContext.php

+4
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ protected function entityTokensReplacements($value) {
367367
foreach ($entity_tokens as $entity_token) {
368368
$token_pieces = explode(':', str_replace(['[', ']'], ['', ''], $entity_token));
369369
array_shift($token_pieces);
370+
if (count($token_pieces) < 4) {
371+
throw new \Exception(sprintf('Missing arguments to find the entity token with name: %s', $entity_token));
372+
}
373+
370374
list($entity_type, $field_key, $field_value, $destiny_replacement) = $token_pieces;
371375

372376
if (!in_array($entity_type, $entity_types)) {

0 commit comments

Comments
 (0)