Commit aef08a5e authored by catch's avatar catch

Issue #2188075 by Berdir, amateescu, xjm: Remove magic getter of EntityReferenceItem.

parent 49be3541
......@@ -129,30 +129,6 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
return $schema;
}
/**
* {@inheritdoc}
*/
public function __get($name) {
$name = ($name == 'value') ? 'target_id' : $name;
return parent::__get($name);
}
/**
* {@inheritdoc}
*/
public function get($property_name) {
$property_name = ($property_name == 'value') ? 'target_id' : $property_name;
return parent::get($property_name);
}
/**
* {@inheritdoc}
*/
public function __isset($property_name) {
$property_name = ($property_name == 'value') ? 'target_id' : $property_name;
return parent::__isset($property_name);
}
/**
* {@inheritdoc}
*/
......
......@@ -125,7 +125,7 @@ public function testAccess() {
entity_view($referencing_entity, 'default');
// Verify the un-accessible item still exists.
$this->assertEqual($referencing_entity->{$field_name}->value, $this->referencedEntity->id(), format_string('The un-accessible item still exists after @name formatter was executed.', array('@name' => $name)));
$this->assertEqual($referencing_entity->{$field_name}->target_id, $this->referencedEntity->id(), format_string('The un-accessible item still exists after @name formatter was executed.', array('@name' => $name)));
}
}
......
......@@ -73,17 +73,17 @@ public function testComments() {
$this->assertEqual('The first comment.', $comment->subject->value);
$this->assertEqual('The first comment body.', $comment->comment_body->value);
$this->assertEqual('filtered_html', $comment->comment_body->format);
$this->assertEqual(0, $comment->pid->value);
$this->assertEqual(1, $comment->entity_id->value);
$this->assertEqual(0, $comment->pid->target_id);
$this->assertEqual(1, $comment->entity_id->target_id);
$this->assertEqual('node', $comment->entity_type->value);
$this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $comment->language()->id);
$comment = entity_load('comment', 2);
$this->assertEqual('The response to the second comment.', $comment->subject->value);
$this->assertEqual(3, $comment->pid->value);
$this->assertEqual(3, $comment->pid->target_id);
$comment = entity_load('comment', 3);
$this->assertEqual('The second comment.', $comment->subject->value);
$this->assertEqual(0, $comment->pid->value);
$this->assertEqual(0, $comment->pid->target_id);
}
}
......@@ -96,7 +96,7 @@ public function testTaxonomyTerms() {
$term = $terms[$tid];
$this->assertIdentical($term->name->value, "term {$tid} of vocabulary {$values['source_vid']}");
$this->assertIdentical($term->description->value, "description of term {$tid} of vocabulary {$values['source_vid']}");
$this->assertEqual($term->vid->value, $values['vid']);
$this->assertEqual($term->vid->target_id, $values['vid']);
$this->assertEqual($term->weight->value, $values['weight']);
if (empty($values['parent'])) {
$this->assertNull($term->parent->value);
......
......@@ -53,8 +53,8 @@ protected function setUp() {
public function testTermRevisionNode() {
$node = \Drupal::entityManager()->getStorage('node')->loadRevision(2);
$this->assertEqual(count($node->vocabulary_3_i_2_), 2);
$this->assertEqual($node->vocabulary_3_i_2_[0]->value, 4);
$this->assertEqual($node->vocabulary_3_i_2_[1]->value, 5);
$this->assertEqual($node->vocabulary_3_i_2_[0]->target_id, 4);
$this->assertEqual($node->vocabulary_3_i_2_[1]->target_id, 5);
}
}
......@@ -45,11 +45,11 @@ public function testTermNode() {
$nodes = node_load_multiple(array(1, 2), TRUE);
$node = $nodes[1];
$this->assertEqual(count($node->vocabulary_1_i_0_), 1);
$this->assertEqual($node->vocabulary_1_i_0_[0]->value, 1);
$this->assertEqual($node->vocabulary_1_i_0_[0]->target_id, 1);
$node = $nodes[2];
$this->assertEqual(count($node->vocabulary_2_i_1_), 2);
$this->assertEqual($node->vocabulary_2_i_1_[0]->value, 2);
$this->assertEqual($node->vocabulary_2_i_1_[1]->value, 3);
$this->assertEqual($node->vocabulary_2_i_1_[0]->target_id, 2);
$this->assertEqual($node->vocabulary_2_i_1_[1]->target_id, 3);
}
}
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