You are here

public function DisplayFeedTest::testDisabledLinkedDisplay in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php \Drupal\Tests\views\Functional\Plugin\DisplayFeedTest::testDisabledLinkedDisplay()

Tests that the feed display works when the linked display is disabled.

File

core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php, line 189

Class

DisplayFeedTest
Tests the feed display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testDisabledLinkedDisplay() {
  $view = Views::getView('test_attached_disabled');
  $view
    ->setDisplay();

  // Disable the page and link the feed to the page.
  $view->displayHandlers
    ->get('feed_1')
    ->setOption('link_display', 'page_1');
  $view->displayHandlers
    ->get('page_1')
    ->setOption('enabled', FALSE);
  $view
    ->save();
  \Drupal::service('router.builder')
    ->rebuild();
  $this
    ->drupalGet('test-attached-disabled');
  $this
    ->assertSession()
    ->statusCodeEquals(404);

  // Ensure the feed can still be reached.
  $this
    ->drupalGet('test-attached-disabled.xml');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}