You are here

public function CerCrudTest::testExplicitDereference in Corresponding Entity References 7.2

File

tests/crud.test, line 100

Class

CerCrudTest

Code

public function testExplicitDereference() {
  $uid = $this
    ->drupalCreateUser()->uid;
  $nid = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'field_user' => array(
      'und' => array(
        array(
          'target_id' => $uid,
        ),
      ),
    ),
  ))->nid;
  $account = user_load($uid, TRUE);
  $account->field_node = array();
  user_save($account);
  $node = node_load($nid, NULL, TRUE);
  $this
    ->assertFalse($node->field_user, 'Explicitly clearing a reference from the referenced entity clears the corresponding reference on the referrer.', 'CER');
}