function DisplayFeedTest::testDisabledLinkedDisplay

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()
  2. 8.9.x core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php \Drupal\Tests\views\Functional\Plugin\DisplayFeedTest::testDisabledLinkedDisplay()
  3. 10 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 192

Class

DisplayFeedTest
Tests the feed display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testDisabledLinkedDisplay() : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.