You are here

public function ViewsAtomTestCase::test in Views Atom 6

views_atom tests

File

tests/views_atom.test, line 79
Simple tests for views_atom

Class

ViewsAtomTestCase
Tests basic set up for publishing and consuming

Code

public function test() {

  // Create many dummy nodes
  $nodes = array();
  foreach (range(1, 10) as $count) {
    $nodes[] = $this
      ->vaNewNode();
  }

  // Get feed and ensure the nodes are there
  $feed_path = 'views_atom_test/feed.xml';
  $feed = $this
    ->vaFetchFeed($feed_path);
  foreach ($nodes as $node) {
    $this
      ->assertTrue($this
      ->vaNodeInFeed($node->nid, $feed_path), 'Node exists in feed.');
    foreach ($feed['items'] as $item) {
      if ($item['rdf']['nid'] == $node->nid) {
        $rdf = $item['rdf'];
        $this
          ->assertEqual($rdf['title'], $node->title, 'Title set correctly.');
        $this
          ->assertEqual($rdf['type'], $node->type, 'Node type set correctly.');
        $this
          ->assertEqual($rdf['body'], $node->body, 'Body set correctly.');
      }
    }
  }
}