function FieldInfoTestCase::testInstanceDisabledEntityType in Drupal 7
Test that instances on disabled entity types are filtered out.
File
- modules/
field/ tests/ field.test, line 1462 - Tests for field.module.
Class
Code
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'), 'No instances are returned on disabled entity types.');
}