function ABTEnviromentTestCase::envTestFieldInstanceCreation in Access By Term 7
1 call to ABTEnviromentTestCase::envTestFieldInstanceCreation()
File
- ./
abt.test, line 199
Class
Code
function envTestFieldInstanceCreation($entity_types = array(
'node',
'user',
)) {
for ($i = 0; $i < count($entity_types); $i++) {
for ($j = 0; $j < count($this->field_instances[$entity_types[$i]]); $j++) {
$field_name = $this->field_instances[$entity_types[$i]][$j]['field_name'];
$bundle = $this->field_instances[$entity_types[$i]][$j]['bundle'];
$loaded = field_info_instance($entity_types[$i], $field_name, $bundle);
$this
->assertTrue(isset($loaded['id']), t('Field instance created for field (@instname)', array(
'@instname' => $field_name . ' - ' . $loaded['entity_type'],
)));
// Another way to check if field instances are created...
// $info = _field_info_collate_fields();
// $this->assertTrue(
// isset($info['instances'][$entity_types[$i]][$bundle][$field_name]),
// t('Field instance created: (@instname)', array('@instname' => $field_name.' - '.$this->field_instances[$entity_types[$i]][$j]['label']))
// );
}
}
}