public function FeatureContext::after in Booking and Availability Management Tools for Drupal 8
Same name and namespace in other branches
- 7 test/behat/features/bootstrap/FeatureContext.php \FeatureContext::after()
@AfterScenario
File
- test/
behat/ features/ bootstrap/ FeatureContext.php, line 95
Class
- FeatureContext
- Features context.
Code
public function after(AfterScenarioScope $scope) {
foreach ($this
->getUserManager()
->getUsers() as $user) {
$query = \Drupal::entityQuery('bat_event');
$query
->condition('uid', $user->uid);
$event_ids = $query
->execute();
if ($event_ids) {
bat_event_delete_multiple($event_ids);
}
}
if (!empty($this->units)) {
foreach ($this->units as $unit) {
$unit
->delete();
}
}
if (!empty($this->Types)) {
foreach ($this->Types as $type) {
$type
->delete();
}
}
if (!empty($this->typeBundles)) {
foreach ($this->typeBundles as $type_bundle) {
$type_bundle
->delete();
}
}
if (!empty($this->eventTypes)) {
foreach ($this->eventTypes as $event_type) {
$event_type
->delete();
}
}
if (!empty($this->events)) {
bat_event_delete_multiple($this->events);
}
foreach ($this->content_types as $content_type) {
node_type_delete($content_type);
}
foreach ($this->fields as $field) {
field_delete_field($field);
}
}