function ContactSitewideTest::deleteCategories

Deletes all categories.

1 call to ContactSitewideTest::deleteCategories()
ContactSitewideTest::testSiteWideContact in drupal/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
Tests configuration options and the site-wide contact form.

File

drupal/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php, line 298
Definition of Drupal\contact\Tests\ContactSitewideTest.

Class

ContactSitewideTest
Tests the site-wide contact form.

Namespace

Drupal\contact\Tests

Code

function deleteCategories() {
  $categories = entity_load_multiple('contact_category');
  foreach ($categories as $id => $category) {
    $this
      ->drupalPost("admin/structure/contact/manage/{$id}/delete", array(), t('Delete'));
    $this
      ->assertRaw(t('Category %label has been deleted.', array(
      '%label' => $category
        ->label(),
    )));
    $this
      ->assertFalse(entity_load('contact_category', $id), format_string('Category %category not found', array(
      '%category' => $category
        ->label(),
    )));
  }
}