FieldInfoTestCase::testInstanceDisabledEntityType

  1. drupal
    1. 8
    2. 7
Versions
7 FieldInfoTestCase::testInstanceDisabledEntityType()

Test that instances on disabled entity types are filtered out.

Code

modules/field/tests/field.test, line 1210

<?php
function testInstanceDisabledEntityType() {
  // For this test the field type and the entity type must be exposed by
  // different modules.
  $field_definition = array(
    'field_name' => 'field', 
    'type' => 'test_field',
  );
  field_create_field($field_definition);
  $instance_definition = array(
    'field_name' => 'field', 
    'entity_type' => 'comment', 
    'bundle' => 'comment_node_article',
  );
  field_create_instance($instance_definition);

  // Disable coment module. This clears field_info cache.
  module_disable(array('comment'));
  $this->assertNull(field_info_instance('comment', 'field', 'comment_node_article'), t('No instances are returned on disabled entity types.'));
}
?>