summaryrefslogtreecommitdiff
path: root/modules/field/tests/field_test.entity.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/field/tests/field_test.entity.inc')
-rw-r--r--modules/field/tests/field_test.entity.inc47
1 files changed, 46 insertions, 1 deletions
diff --git a/modules/field/tests/field_test.entity.inc b/modules/field/tests/field_test.entity.inc
index b7887c812..149c09a2c 100644
--- a/modules/field/tests/field_test.entity.inc
+++ b/modules/field/tests/field_test.entity.inc
@@ -73,6 +73,48 @@ function field_test_entity_info() {
'bundles' => array('test_entity_2' => array('label' => 'Test entity 2')),
'view modes' => $test_entity_modes,
),
+ // @see EntityPropertiesTestCase::testEntityLabel()
+ 'test_entity_no_label' => array(
+ 'name' => t('Test entity without label'),
+ 'fieldable' => TRUE,
+ 'field cache' => FALSE,
+ 'base table' => 'test_entity',
+ 'entity keys' => array(
+ 'id' => 'ftid',
+ 'revision' => 'ftvid',
+ 'bundle' => 'fttype',
+ ),
+ 'bundles' => $bundles,
+ 'view modes' => $test_entity_modes,
+ ),
+ 'test_entity_label' => array(
+ 'name' => t('Test entity label'),
+ 'fieldable' => TRUE,
+ 'field cache' => FALSE,
+ 'base table' => 'test_entity',
+ 'entity keys' => array(
+ 'id' => 'ftid',
+ 'revision' => 'ftvid',
+ 'bundle' => 'fttype',
+ 'label' => 'ftlabel',
+ ),
+ 'bundles' => $bundles,
+ 'view modes' => $test_entity_modes,
+ ),
+ 'test_entity_label_callback' => array(
+ 'name' => t('Test entity label callback'),
+ 'fieldable' => TRUE,
+ 'field cache' => FALSE,
+ 'base table' => 'test_entity',
+ 'label callback' => 'field_test_entity_label_callback',
+ 'entity keys' => array(
+ 'id' => 'ftid',
+ 'revision' => 'ftvid',
+ 'bundle' => 'fttype',
+ ),
+ 'bundles' => $bundles,
+ 'view modes' => $test_entity_modes,
+ ),
);
}
@@ -163,7 +205,7 @@ function field_test_delete_bundle($bundle) {
/**
* Creates a basic test_entity entity.
*/
-function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = 'test_bundle') {
+function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = 'test_bundle', $label = '') {
$entity = new stdClass();
// Only set id and vid properties if they don't come as NULL (creation form).
if (isset($id)) {
@@ -174,6 +216,9 @@ function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = 'test_bundle
}
$entity->fttype = $bundle;
+ $label = !empty($label) ? $label : $bundle . ' label';
+ $entity->ftlabel = $label;
+
return $entity;
}