public function CerCrudTest::testImplicitReferenceCreation in Corresponding Entity References 7.2
File
- tests/
crud.test, line 50
Class
Code
public function testImplicitReferenceCreation() {
$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;
}
$references = array();
foreach (user_load($uid, TRUE)->field_node['und'] as $reference) {
$references[] = $reference['target_id'];
}
$this
->assertFalse(array_diff($referrers, $references), 'Creating 5 referrers to a single entity creates 5 corresponding references on that entity.', 'CER');
}