function EntityDependencyTestCase::testNodeUser in Entity Dependency API 7
Test basic scenario with node & author.
File
- ./
entity_dependency.test, line 99 - Entity Dependency tests.
Class
- EntityDependencyTestCase
- Tests the entity dependency iterator.
Code
function testNodeUser() {
$author = $this
->drupalCreateUser();
$node = $this
->drupalCreateNode(array(
'type' => 'article',
'uid' => $author->uid,
));
$this->entities = array(
array(
'id' => $node->nid,
'type' => 'node',
),
);
$i = 0;
foreach ($this
->getIterator() as $entity) {
switch ($i) {
case 0:
$this
->assertCorrectEntityOrder($entity, 'user', 'uid', $author->uid);
break;
case 1:
$this
->assertCorrectEntityOrder($entity, 'node', 'nid', $node->nid);
break;
}
$i++;
}
$this
->assertEqual($i, 2, 'Correct number of entities was iterated over.');
}