You are here

public function FeatureContext::deleteUserConsentEntities in Open Social 10.3.x

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

Remove any user consents that were created.

@AfterScenario @data-policy-create

File

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

Class

FeatureContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function deleteUserConsentEntities() {
  $consents = \Drupal::entityTypeManager()
    ->getStorage('user_consent')
    ->loadMultiple();
  foreach ($consents as $consent) {
    try {
      $consent
        ->delete();
    } catch (\Throwable $e) {

      // This can be fine.
    }
  }
}