You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In RawDrupalContext, there is an AfterScenario that deletes roles that were programmatically created by other step definitions that were executed:
/**
* Remove any created roles.
*
* @AfterScenario
*/
public function cleanRoles() {
// Remove any roles that were created.
foreach ($this->roles as $rid) {
$this->getDriver()->roleDelete($rid);
}
$this->roles = array();
}
For the Drupal8 core, this code gets run:
/**
* {@inheritdoc}
*/
public function roleDelete($role_name) {
$role = user_role_load($role_name);
if (!$role) {
throw new \RuntimeException(sprintf('No role "%s" exists.', $role_name));
}
$role->delete();
}
The problem is that the role may no longer exist, since actions taken during the step may have deleted the role. This exception causes the test to fail even though everything is fine.
I noticed that the other "delete" methods on the Drupal8 core first check that the entity being deleted exists before deleting it. I think we should do the same here.
The text was updated successfully, but these errors were encountered:
In RawDrupalContext, there is an AfterScenario that deletes roles that were programmatically created by other step definitions that were executed:
For the Drupal8 core, this code gets run:
The problem is that the role may no longer exist, since actions taken during the step may have deleted the role. This exception causes the test to fail even though everything is fine.
I noticed that the other "delete" methods on the Drupal8 core first check that the entity being deleted exists before deleting it. I think we should do the same here.
The text was updated successfully, but these errors were encountered: