You are here

function title_test_phase_check in Title 7

Check the entity label at a give phase.

4 calls to title_test_phase_check()
TitleFieldReplacementTestCase::testFieldReplacementWorkflow in tests/TitleFieldReplacementTestCase.test
Test field replacement API and workflow.
title_test_entity_load in tests/title_test.module
Implements hook_entity_load().
title_test_entity_prepare_view in tests/title_test.module
Implements hook_entity_prepare_view().
title_test_field_attach_load in tests/title_test.module
Implements hook_field_attach_load().

File

tests/title_test.module, line 85
Testing functionality for Title module.

Code

function title_test_phase_check($phase, $entity) {
  $info = entity_get_info('test_entity');
  $label_key = $info['entity keys']['label'];
  $field_name = $label_key . '_field';
  $langcode = LANGUAGE_NONE;
  if (isset($entity->type)) {
    $langcode = entity_language($entity->type, $entity);
  }
  $value = $entity->{$label_key} == $entity->{$field_name}[$langcode][0]['value'];
  title_test_phase_store($phase, $value);
  return $value;
}