public function FeatureContext::after in Booking and Availability Management Tools for Drupal 7
Same name and namespace in other branches
- 8 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) {
$query2 = new EntityFieldQuery();
$query2
->entityCondition('entity_type', 'bat_event')
->propertyCondition('uid', $user->uid);
$result = $query2
->execute();
if (isset($result['bat_event'])) {
$event_ids = array_keys($result['bat_event']);
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);
}
}