You are here

function CustomBreadcrumbsFeaturesIntegrationTestCase::testFeaturesUI in Custom Breadcrumbs Features 7.2

If I create a breadcrumb, it shows up in the features interface. If I delete a breadcrumb, it does not show up in the features interface.

File

tests/features_integration.test, line 96
Test that custom_breadcrumbs_features provides custom_breadcrumbs with features integration.

Class

CustomBreadcrumbsFeaturesIntegrationTestCase
Test that Custom Breadcrumbs can be exported and rebuilt using Features.

Code

function testFeaturesUI() {

  // Create dummy breadcrumbs, keyed by type.
  $crumbs = array();
  $crumbs['custom_breadcrumb'] = array(
    'node_type' => 'page',
  );
  $crumbs['custom_breadcrumbsapi'] = array(
    'module_page' => 'maintenance_page',
  );
  $crumbs['custom_breadcrumbs_paths'] = array(
    'specific_path' => 'admin',
  );
  $crumbs['custom_breadcrumbs_taxonomy_vocabulary'] = array(
    'vid' => taxonomy_vocabulary_machine_name_load('tags')->vid,
    'paths' => 'node',
  );
  foreach ($crumbs as $table => $edit) {
    $crumbs[$table]['name'] = $this
      ->randomName();
    $crumbs[$table]['machine_name'] = drupal_strtolower($crumbs[$table]['name']);
  }
  foreach ($crumbs as $table => $edit) {
    $this
      ->createBreadcrumb($table, $edit);
  }

  // Assert they show up in features UI.
  $this
    ->drupalGet('admin/structure/features/create');
  $this
    ->assertResponse(200);
  foreach ($crumbs as $edit) {
    $this
      ->assertText($edit['name']);
  }

  // Delete breadcrumbs.
  foreach ($crumbs as $table => $edit) {
    $crumb = $this
      ->loadBreadcrumb($table, $edit['machine_name']);
    $this
      ->deleteBreadcrumb($table, $crumb->bid);
  }

  // Assert they do not show up in features UI.
  $this
    ->drupalGet('admin/structure/features/create');
  $this
    ->assertResponse(200);
  foreach ($crumbs as $edit) {
    $this
      ->assertNoText($edit['name']);
  }
}