/**
  * Creates a custom ticket type based on default settings.
  *
  * @param array $values
  *   An array of settings to change from the defaults.
  *   Example: 'type' => 'foo'.
  *
  * @return \Drupal\support_ticket\Entity\SupportTicketType
  *   Created support ticket type.
  */
 protected function supportTicketCreateSupportTicketType(array $values = array())
 {
     // Find a non-existent random type name.
     if (!isset($values['type'])) {
         do {
             $id = strtolower($this->randomMachineName(8));
         } while (SupportTicketType::load($id));
     } else {
         $id = $values['type'];
     }
     $values += array('type' => $id, 'name' => $id);
     $type = entity_create('support_ticket_type', $values);
     $status = $type->save();
     support_ticket_add_body_field($type);
     \Drupal::service('router.builder')->rebuild();
     $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created support ticket type %type.', array('%type' => $type->id())));
     return $type;
 }