function FieldInfoTestCase::testInstanceDisabledEntityType
7.x field.test | FieldInfoTestCase::testInstanceDisabledEntityType() |
Test that instances on disabled entity types are filtered out.
File
- drupal-7.x/
modules/ field/ tests/ field.test, line 1402 - 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.');
}