You are here

public function CerCrudTest::testDuplicateReferencePrevention in Corresponding Entity References 7.2

File

tests/crud.test, line 72

Class

CerCrudTest

Code

public function testDuplicateReferencePrevention() {
  $uid = $this
    ->drupalCreateUser()->uid;
  $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'field_user' => array(
      'und' => array(
        array(
          'target_id' => $uid,
        ),
        array(
          'target_id' => $uid,
        ),
      ),
    ),
  ));
  $account = user_load($uid, TRUE);
  $this
    ->assertEqual(sizeof($account->field_node['und']), 1, 'Creating two references to an entity from a single referrer creates one corresponding reference.', 'CER');
}