Commit f8ff417c authored by webchick's avatar webchick

Issue #2579411 by yched: Resolve @todo by adding test in EntityReferenceFieldTest

parent 4694001f
......@@ -105,8 +105,14 @@ public function testEntityReferenceFieldValidation() {
$this->assertEqual($violations->count(), 1, 'Validation throws a violation.');
$this->assertEqual($violations[0]->getMessage(), t('The referenced entity (%type: %id) does not exist.', array('%type' => $this->referencedEntityType, '%id' => 9999)));
// @todo Implement a test case for invalid bundle references after
// is fixed.
// Test a non-referenceable bundle.
entity_test_create_bundle('non_referenceable', NULL, $this->referencedEntityType);
$referenced_entity = entity_create($this->referencedEntityType, array('type' => 'non_referenceable'));
$entity->{$this->fieldName}->target_id = $referenced_entity->id();
$violations = $entity->{$this->fieldName}->validate();
$this->assertEqual($violations->count(), 1, 'Validation throws a violation.');
$this->assertEqual($violations[0]->getMessage(), t('The entity must be of bundle %bundle.', array('%bundle' => $this->bundle)));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment