public function FieldHelperTestCase::testGetReferencingFields in Helper 7
Tests FieldHelper::getEntityReferencingFields() and FieldHelper::getEntityReferencingFieldColumns().
File
- tests/
FieldHelperTestCase.test, line 136
Class
Code
public function testGetReferencingFields() {
$this
->assertIdentical(count(FieldHelper::getEntityReferencingFields()), 5);
$this
->assertIdentical(FieldHelper::getEntityReferencingFieldColumns('field_file'), array(
'fid' => 'file',
));
$this
->assertIdentical(FieldHelper::getEntityReferencingFieldColumns('field_image'), array(
'fid' => 'file',
));
$this
->assertIdentical(FieldHelper::getEntityReferencingFieldColumns('field_taxonomy_term_reference'), array(
'tid' => 'taxonomy_term',
));
$this
->assertIdentical(FieldHelper::getEntityReferencingFieldColumns('field_entity_node'), array(
'target_id' => 'node',
));
$this
->assertIdentical(FieldHelper::getEntityReferencingFieldColumns('field_entity_taxonomy'), array(
'target_id' => 'taxonomy_term',
));
field_delete_field('field_entity_taxonomy');
field_delete_field('field_entity_node');
$this
->assertIdentical(count(FieldHelper::getEntityReferencingFields()), 3);
$this
->assertFalse(FieldHelper::getEntityReferencingFieldColumns('field_entity_node'));
$this
->assertFalse(FieldHelper::getEntityReferencingFieldColumns('field_entity_taxonomy'));
}