You are here

public function CerBasicTestCase::testUpdateChangeTarget in Corresponding Entity References 7.3

File

tests/CerBasicTestCase.test, line 104

Class

CerBasicTestCase

Code

public function testUpdateChangeTarget() {
  $target = $this
    ->drupalCreateUser();
  $this->node->field_author[LANGUAGE_NONE][0]['target_id'] = $target->uid;
  node_save($this->node);

  // The original author should no longer reference the node.
  $this
    ->assertEqual(0, $this
    ->reload('user', $this->author)->field_pages
    ->count());

  /** @var EntityDrupalWrapper $target */
  $target = $this
    ->reload('user', $target);
  $this
    ->assertEqual(1, $target->field_pages
    ->count());
  $this
    ->assertEqual($this->node->nid, $target->field_pages[0]->nid
    ->value());
}