예제 #1
0
 /**
  * @AfterScenario
  */
 public function after(AfterScenarioScope $scope)
 {
     if (!empty($this->bookings)) {
         rooms_booking_delete_multiple($this->bookings);
     }
     if (!empty($this->customerProfiles)) {
         commerce_customer_profile_delete_multiple($this->customerProfiles);
         db_delete('rooms_customers')->condition('commerce_customer_id', $this->customerProfiles)->execute();
     }
     if (!empty($this->units)) {
         foreach ($this->units as $unit) {
             $unit->delete();
         }
     }
 }
예제 #2
0
 public function afterScenario($event)
 {
     foreach ($this->users as $user) {
         $query = new EntityFieldQuery();
         $query->entityCondition('entity_type', 'commerce_order')->propertyCondition('uid', $user->uid);
         $result = $query->execute();
         if (isset($result['commerce_order'])) {
             $order_ids = array_keys($result['commerce_order']);
             commerce_order_delete_multiple($order_ids);
         }
         $query2 = new EntityFieldQuery();
         $query2->entityCondition('entity_type', 'rooms_booking')->propertyCondition('uid', $user->uid);
         $result = $query2->execute();
         if (isset($result['rooms_booking'])) {
             $booking_ids = array_keys($result['rooms_booking']);
             rooms_booking_delete_multiple($booking_ids);
         }
     }
     parent::afterScenario($event);
     if (!empty($this->units)) {
         foreach ($this->units as $unit) {
             $unit->delete();
         }
     }
     if (!empty($this->unitTypes)) {
         foreach ($this->unitTypes as $unit_type) {
             $unit_type->delete();
         }
     }
     if (!empty($this->bookingTypes)) {
         foreach ($this->bookingTypes as $booking_type) {
             $booking_type->delete();
         }
     }
     if (!empty($this->bookings)) {
         rooms_booking_delete_multiple($this->bookings);
     }
     if (!empty($this->customerProfiles)) {
         commerce_customer_profile_delete_multiple($this->customerProfiles);
         db_delete('rooms_customers')->condition('commerce_customer_id', $this->customerProfiles)->execute();
     }
     if (!empty($this->products)) {
         $product_ids = array();
         foreach ($this->products as $product) {
             $product_ids[] = $product->product_id;
         }
         commerce_product_delete_multiple($product_ids);
     }
     foreach ($this->content_types as $content_type) {
         node_type_delete($content_type);
     }
     foreach ($this->fields as $field) {
         field_delete_field($field);
     }
 }