public function CerCrudTest::testReferrerDeletion in Corresponding Entity References 7.2
File
- tests/
crud.test, line 120
Class
Code
public function testReferrerDeletion() {
$uid = $this
->drupalCreateUser()->uid;
$referrers = array();
for ($i = 0; $i < 5; $i++) {
$referrers[] = $this
->drupalCreateNode(array(
'type' => 'page',
'field_user' => array(
'und' => array(
array(
'target_id' => $uid,
),
),
),
))->nid;
}
node_delete($referrers[0]);
$references = array();
foreach (user_load($uid, TRUE)->field_node['und'] as $reference) {
$references[] = $reference['target_id'];
}
$this
->assertFalse(in_array($referrers[0], $references), 'Deleting a referrer clears corresponding reference on the referenced entity.', 'CER');
}