Nodes and users created on EntityContext, must be stored as array#196
Nodes and users created on EntityContext, must be stored as array#196rsanzante merged 2 commits intoMetadrop:mainfrom
Conversation
…or uid, to be compatible with Core Driver entity deletion.
|
There is a problem with the fix. The patch changes the type of the data stores in Metadrop\Behat\Context\EntityContext's $users and $nodes properties. I don't see $nodes or $users in parent classes. But the mai problem is Metadrop\Behat\Context\EntityContext itself. Let's see the method getGivenEntitiesMap: This function returns entity ids. It's clear when you see where is used, in purgeEntities: I agree we should reviewed if this is required or not, but I thjink the patch should address also the getGivenEntitiesMap methods, may it's just to update it so it returns ids. |
@albeortev @juanjol at this lines of EntityContext: if (!empty($given_entities[$entity_type])) {
$entities_ids = array_diff($entities_ids, $given_entities[$entity_type]);
};$given_entities[$entity_type] must be an array of entity IDS, but with the last change it is a list of entities. Can you adapt it? Suggestion: |
|
Updated the PR, now we use the nodes and users IDs, but this is redundant as clearing of nodes is done on the parent class. |
|
The EntityContext clears entities created during scenarios that are not managed by contexts with @purgeEntities tag. For example, a node created by submitting the node/add form. That lines of code that you have adapted prevents deleting the entities that have been created by contexts. So it is still necessary adapting it. |
|
THanks for the fix @juanjol , after @albeortev review this we can merge it. |
EntityContext must keep the same structure as the parent class for the nodes and users arrays, storing the object with nid, type, etc., not only the id. This throw a warning:
This PR fixes the structure of the arrays, removing this warning. In the future, it is advisable to review whether EntityContext.php really needs to keep track of nodes and users, as the parent class already takes care of those entity types.