You are here

public function ViewsContentPanesTest::testViewMoreLink in Chaos Tool Suite (ctools) 7

Tests rendering a content pane with a more link.

File

views_content/tests/src/views_content.test, line 45
Contains ViewsContentPanesTest.

Class

ViewsContentPanesTest
Tests rendering views content pane displays.

Code

public function testViewMoreLink() {

  // The view "views_content_more_link" has two displays: a content pane
  // display and a page display. The content pane display displays 3 nodes,
  // the page display displays all items.
  // On the content pane display a "more" link is configured that should link
  // to the page.
  $view = views_get_view('views_content_more_link');

  // Create four nodes that the view will display. The first three
  // will get displayed on the content pane display and the remaining
  // on the page display.
  for ($i = 0; $i < 4; $i++) {
    $this
      ->drupalCreateNode();
  }

  // Render the content pane display and assert that a more link is shown.
  $view
    ->set_display('panel_pane_1');
  $rendered_output = $view
    ->preview();
  $this
    ->verbose($rendered_output);
  $this
    ->storeViewPreview($rendered_output);
  $this
    ->assertLink('more');
  $this
    ->assertLinkByHref('views-content-more-link');
}