You are here

function EntityDependencyTestCase::testNode in Entity Dependency API 7

Test if single node passes iterator.

File

./entity_dependency.test, line 74
Entity Dependency tests.

Class

EntityDependencyTestCase
Tests the entity dependency iterator.

Code

function testNode() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'uid' => 1,
  ));
  $this->entities = array(
    array(
      'id' => $node->nid,
      'type' => 'node',
    ),
  );
  $i = 0;
  foreach ($this
    ->getIterator() as $entity) {
    switch ($i) {
      case 0:
        $this
          ->assertCorrectEntityOrder($entity, 'node', 'nid', $node->nid);
        break;
    }
    $i++;
  }
  $this
    ->assertEqual($i, 1, 'Correct number of entities was iterated over.');
}