Download & Extend

field_test_entity_info does not set a 'label' on the Test Entity

Project:Drupal core
Version:7.x-dev
Component:entity system
Category:bug report
Priority:normal
Assigned:_wdm_
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

field_test_entity_info does not set a 'label' on the Test Entity
Instead it sets a name.
This causes warnings during testing and in Drupal 7 causes test-results to be deemed as failure when running from Jenkins using drush.

Patch to follow.

Comments

#1

Patch for fix

AttachmentSizeStatusTest resultOperations
field_test_entity_info-1812822.1.patch3.1 KBIdlePASSED: [[SimpleTest]]: [MySQL] 42,249 pass(es).View details

#2

Status:active» needs review

#3

Status:needs review» reviewed & tested by the community

seems straight forward to me.

#4

Agreed. Looks simple enough.

#5

Status:reviewed & tested by the community» needs work
Issue tags:+Needs tests

@beejeebus would like to see a -fail patch that demonstrates the failures without this patch.

#6

Status:needs work» needs review
Issue tags:-Needs tests

New patch adds tests

AttachmentSizeStatusTest resultOperations
field_test_entity_info-1812822-pass.6.patch4.08 KBIdlePASSED: [[SimpleTest]]: [MySQL] 42,605 pass(es).View details
field_test_entity_info-1812822-6.fail_.patch1001 bytesIdleFAILED: [[SimpleTest]]: [MySQL] 42,606 pass(es), 0 fail(s), and 1 exception(s).View details

#7

Status:needs review» needs work

The last submitted patch, field_test_entity_info-1812822-6.fail_.patch, failed testing.

#8

Status:needs work» reviewed & tested by the community

great, this looks ready to go.

#9

Status:reviewed & tested by the community» needs review

+++ b/core/modules/field/tests/modules/field_test/field_test.entity.incundefined
@@ -90,7 +90,7 @@ function field_test_entity_info() {
-      'name' => t('Test entity without label'),
+      'label' => t('Test entity without label'),

Is that right? Seems to be the opposite of what is intended?

#10

Status:needs review» reviewed & tested by the community

Hi @webchick
I thought the same at first, but the 'without label' is for the actual entities, not the entity type.
Eg node's label is the title.
The without label refers to the 'entity keys' not having a label entry - here's the relevant bits

// @see EntityPropertiesTestCase::testEntityLabel()
    'test_entity_no_label' => array(
      'name' => t('Test entity without label'),
      'entity class' => 'Drupal\field_test\TestEntity',
      'controller class' => 'Drupal\field_test\TestEntityController',
      'fieldable' => TRUE,
      'field cache' => FALSE,
      'base table' => 'test_entity',
      'revision table' => 'test_entity_revision',
      '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'),
      'entity class' => 'Drupal\field_test\TestEntity',
      'controller class' => 'Drupal\field_test\TestEntityController',
      'fieldable' => TRUE,
      'field cache' => FALSE,
      'base table' => 'test_entity',
      'revision table' => 'test_entity_revision',
      'entity keys' => array(
        'id' => 'ftid',
        'revision' => 'ftvid',
        'bundle' => 'fttype',
        'label' => 'ftlabel',
      ),
      'bundles' => $bundles,
      'view modes' => $test_entity_modes,
    ),

Lee

#11

Version:8.x-dev» 7.x-dev
Status:reviewed & tested by the community» patch (to be ported)

Ah, ok. Thanks for the explanation.

Committed and pushed to 8.x. Thanks! Moving to 7.x.

#12

Assigned to:larowlan» _wdm_
Status:patch (to be ported)» needs review
AttachmentSizeStatusTest resultOperations
field_test_entity_info-1812822-12.fail_.patch916 bytesIdleFAILED: [[SimpleTest]]: [MySQL] 39,544 pass(es), 0 fail(s), and 2 exception(s).View details
field_test_entity_info-1812822-pass.12.patch3.68 KBIdlePASSED: [[SimpleTest]]: [MySQL] 39,579 pass(es).View details

#13

Status:needs review» reviewed & tested by the community

Straight backport

#14

Status:reviewed & tested by the community» fixed

Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/735adae7f3051b4e1701dd46...

However, I'm not sure what was going on with this (in the D7 patch):

+
+
     // Test a valid entity type but an invalid bundle.

I removed the extra lines on commit.

#15

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here