Skip to content

Commit 5c25ce8

Browse files
authored
Merge pull request #196 from juanjol/master
Nodes and users created on EntityContext, must be stored as array
2 parents a1fb96c + 371da5a commit 5c25ce8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/Behat/Context/EntityContext.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,12 @@ protected function getGivenEntitiesMap(): array {
474474
$map[$item['entity_type']][] = $item['entity_id'];
475475
};
476476

477-
$map['user'] = $this->users;
478-
$map['node'] = $this->nodes;
477+
$map['user'] = array_map(function ($user) {
478+
return $user->uid;
479+
}, $this->users);
480+
$map['node'] = array_map(function ($node) {
481+
return $node->nid;
482+
}, $this->nodes);
479483

480484
return $map;
481485
}
@@ -560,15 +564,15 @@ public function entityCreate($entity_type, $entity) {
560564
public function afterNodeCreate(AfterNodeCreateScope $scope) {
561565

562566
$node = $scope->getEntity();
563-
$this->nodes[] = $node->nid;
567+
$this->nodes[] = $node;
564568
}
565569

566570
/**
567571
* @afterUserCreate
568572
*/
569573
public function afterUserCreate(AfterUserCreateScope $scope) {
570574
$user = $scope->getEntity();
571-
$this->users[] = $user->uid;
575+
$this->users[] = $user;
572576
}
573577

574578
#[\Behat\Hook\AfterScenario]

0 commit comments

Comments
 (0)