From 84e34e4ad401b70d8602e06bfdb7124292eecc3d Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Sun, 3 Jun 2012 17:10:00 -0400 Subject: Issue #822418 by catch, marcingy, davidjdagino, no_commit_credit, tim.plunkett, ezheidtmann: Fixed Field form structure incomplete if field_access() returns FALSE. --- modules/field/tests/field.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/field/tests') diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test index f7d9dddb2..0f7c41740 100644 --- a/modules/field/tests/field.test +++ b/modules/field/tests/field.test @@ -1650,6 +1650,18 @@ class FieldFormTestCase extends FieldTestCase { $langcode = LANGUAGE_NONE; + // Test that the form structure includes full information for each delta + // apart from #access. + $entity_type = 'test_entity'; + $entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']); + + $form = array(); + $form_state = form_state_defaults(); + field_attach_form($entity_type, $entity, $form, $form_state); + + $this->assertEqual($form[$field_name_no_access][$langcode][0]['value']['#entity_type'], $entity_type, 'The correct entity type is set in the field structure.'); + $this->assertFalse($form[$field_name_no_access]['#access'], 'Field #access is FALSE for the field without edit access.'); + // Display creation form. $this->drupalGet('test-entity/add/test-bundle'); $this->assertNoFieldByName("{$field_name_no_access}[$langcode][0][value]", '', t('Widget is not displayed if field access is denied.')); -- cgit v1.2.3