');
+ $results = $this->elements->xpath('//div[@id="block-node-recent"]');
+ $div = $results[0];
+ if (!count($this->nodes)) {
+ $this->assertFalse($div, t('Block does not appear when no nodes exist.'));
+ return;
+ }
+ $this->assertTrue($div, t('Block appears when several nodes exist.'));
+ $title = $div->h2;
+ $this->assertEqual($title, t('Recently posted'), t('Title of the block matches correctly.'));
+ // Under the block div, we have the , and then another
+ // div surrounding the themed item list before we get to the ul.
+ $ul = $div->div->div->ul;
+ $this->assertEqual(count($ul->li), min(count($this->nodes), $count), t('The correct number of nodes are shown.'));
+ for ($i = 0; $i < $count; $i++) {
+ if (isset($this->nodes[$i])) {
+ $list_item = $ul->li[$i];
+ $link = $list_item->a;
+ $this->assertEqual($link, $this->nodes[$i]->title, t('The correct node title is shown.'));
+ }
+ }
+ }
+}