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.

Files: 
CommentFileSizeAuthor
#12 field_test_entity_info-1812822-12.fail_.patch916 bytes_wdm_
FAILED: [[SimpleTest]]: [MySQL] 39,544 pass(es), 0 fail(s), and 2 exception(s).
[ View ]
#12 field_test_entity_info-1812822-pass.12.patch3.68 KB_wdm_
PASSED: [[SimpleTest]]: [MySQL] 39,579 pass(es).
[ View ]
#6 field_test_entity_info-1812822-pass.6.patch4.08 KBlarowlan
PASSED: [[SimpleTest]]: [MySQL] 42,605 pass(es).
[ View ]
#6 field_test_entity_info-1812822-6.fail_.patch1001 byteslarowlan
FAILED: [[SimpleTest]]: [MySQL] 42,606 pass(es), 0 fail(s), and 1 exception(s).
[ View ]
#1 field_test_entity_info-1812822.1.patch3.1 KBlarowlan
PASSED: [[SimpleTest]]: [MySQL] 42,249 pass(es).
[ View ]

Comments

larowlan’s picture

Issue tags:+needs backport to D7
StatusFileSize
new3.1 KB
PASSED: [[SimpleTest]]: [MySQL] 42,249 pass(es).
[ View ]

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.

cbiggins’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
StatusFileSize
new1001 bytes
FAILED: [[SimpleTest]]: [MySQL] 42,606 pass(es), 0 fail(s), and 1 exception(s).
[ View ]
new4.08 KB
PASSED: [[SimpleTest]]: [MySQL] 42,605 pass(es).
[ View ]

New patch adds tests

Status:Needs review» Needs work

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

beejeebus’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
StatusFileSize
new3.68 KB
PASSED: [[SimpleTest]]: [MySQL] 39,579 pass(es).
[ View ]
new916 bytes
FAILED: [[SimpleTest]]: [MySQL] 39,544 pass(es), 0 fail(s), and 2 exception(s).
[ View ]
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.