Tests the readmore functionality.
public function testReadMore() {
$expected_more_text = 'custom more text';
$view = views_get_view('test_display_more');
$this
->executeView($view);
$output = $view
->preview();
$output = drupal_render($output);
$this
->drupalSetContent($output);
$result = $this
->xpath('//div[@class=:class]/a', array(
':class' => 'more-link',
));
$this
->assertEqual($result[0]
->attributes()->href, url('test_display_more'), 'The right more link is shown.');
$this
->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the renderMoreLink method directly. This could be directly unit
// tested.
$more_link = $view->display_handler
->renderMoreLink();
$this
->drupalSetContent($more_link);
$result = $this
->xpath('//div[@class=:class]/a', array(
':class' => 'more-link',
));
$this
->assertEqual($result[0]
->attributes()->href, url('test_display_more'), 'The right more link is shown.');
$this
->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the useMoreText method directly. This could be directly unit
// tested.
$more_text = $view->display_handler
->useMoreText();
$this
->assertEqual($more_text, $expected_more_text, 'The right more text is chosen.');
}