You are here

public function FeatureContext::cleanupUser in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::cleanupUser()
  2. 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::cleanupUser()
  3. 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::cleanupUser()

Remove any groups that were created.

@AfterScenario

File

tests/behat/features/bootstrap/FeatureContext.php, line 755

Class

FeatureContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function cleanupUser(AfterScenarioScope $scope) {
  if (!empty($this->intended_user_names)) {
    foreach ($this->intended_user_names as $name) {
      $user_obj = user_load_by_name($name);
      \Drupal::entityTypeManager()
        ->getStorage('user')
        ->load($user_obj
        ->id())
        ->delete();
    }
  }
}