You are here

function ContactSitewideTestCase::deleteCategories in Drupal 7

Deletes all categories.

1 call to ContactSitewideTestCase::deleteCategories()
ContactSitewideTestCase::testSiteWideContact in modules/contact/contact.test
Tests configuration options and the site-wide contact form.

File

modules/contact/contact.test, line 277
Tests for the Contact module.

Class

ContactSitewideTestCase
Tests the site-wide contact form.

Code

function deleteCategories() {
  $categories = $this
    ->getCategories();
  foreach ($categories as $category) {
    $category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(
      ':cid' => $category,
    ))
      ->fetchField();
    $this
      ->drupalPost('admin/structure/contact/delete/' . $category, array(), t('Delete'));
    $this
      ->assertRaw(t('Category %category has been deleted.', array(
      '%category' => $category_name,
    )), 'Category deleted successfully.');
  }
}