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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Patch for fix

larowlan’s picture

Status: Active » Needs review
rcross’s picture

Status: Needs review » Reviewed & tested by the community

seems straight forward to me.

CB’s picture

Agreed. Looks simple enough.

larowlan’s picture

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.

larowlan’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1001 bytes
4.08 KB

New patch adds tests

Status: Needs review » Needs work

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

Anonymous’s picture

Status: Needs work » Reviewed & tested by the community

great, this looks ready to go.

webchick’s picture

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?

larowlan’s picture

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

webchick’s picture

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.

_wdm_’s picture

Assigned: larowlan » _wdm_
Status: Patch (to be ported) » Needs review
FileSize
3.68 KB
916 bytes
larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Straight backport

David_Rothstein’s picture

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.

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