You are here

public function TitleAdminSettingsTestCase::doTestAutomatedFieldAttachment in Title 7

Check that the fields are replaced or skipped depending on the given value.

Parameters

bool $enabled: Whether replacement is enabled or not.

1 call to TitleAdminSettingsTestCase::doTestAutomatedFieldAttachment()
TitleAdminSettingsTestCase::testAutomatedFieldAttachment in tests/TitleAdminSettingsTestCase.test
Check for automated title_field attachment.

File

tests/TitleAdminSettingsTestCase.test, line 59

Class

TitleAdminSettingsTestCase
Tests for legacy field replacement.

Code

public function doTestAutomatedFieldAttachment($enabled) {
  $edit = array(
    'title_taxonomy_term[auto_attach][name]' => $enabled,
    'title_taxonomy_term[auto_attach][description]' => $enabled,
  );
  $this
    ->drupalPost('admin/config/content/title', $edit, t('Save configuration'));
  $edit = array(
    'name' => $this
      ->randomName(),
    'machine_name' => drupal_strtolower($this
      ->randomName()),
    'description' => $this
      ->randomString(16),
  );
  $this
    ->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
  $entity_type = 'taxonomy_term';
  $bundle = $edit['machine_name'];
  field_info_cache_clear();
  $this
    ->assertTrue(title_field_replacement_enabled($entity_type, $bundle, 'name') == $enabled, 'Name field correctly processed.');
  $this
    ->assertTrue(title_field_replacement_enabled($entity_type, $bundle, 'description') == $enabled, 'Description field correctly processed.');
}