1 field.test | FieldInfoTestCase::testInstanceDisabledEntityType() |
Test that instances on disabled entity types are filtered out.
File
- core/
modules/ field/ tests/ field.test, line 1397 - 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_post',
);
field_create_instance($instance_definition);
// Disable the Comment module. This clears field_info cache.
module_disable(array('comment'));
$this->assertNull(field_info_instance('comment', 'field', 'comment_node_post'), 'No instances are returned on disabled entity types.');
}