Commit 75110eb0 authored by catch's avatar catch
Browse files

Issue #3305413 by joachim, Anchal_gupta, rpayanm, smustgrave, quietone: change...

Issue #3305413 by joachim, Anchal_gupta, rpayanm, smustgrave, quietone: change setup tasks in RssTest to use API calls
parent 40c86d90
Loading
Loading
Loading
Loading
+15 −20
Original line number Diff line number Diff line
@@ -86,27 +86,23 @@ public function testTaxonomyRss() {
    // Create two taxonomy terms.
    $term1 = $this->createTerm($this->vocabulary);

    // RSS display must be added manually.
    $this->drupalGet("admin/structure/types/manage/article/display");
    $edit = [
      "display_modes_custom[rss]" => '1',
    ];
    $this->submitForm($edit, 'Save');
    // Add the RSS display.
    $default_display = $this->container->get('entity_display.repository')->getViewDisplay('node', 'article');
    $rss_display = $default_display->createCopy('rss');
    $rss_display->save();

    // Change the format to 'RSS category'.
    $this->drupalGet("admin/structure/types/manage/article/display/rss");
    $edit = [
      "fields[taxonomy_" . $this->vocabulary->id() . "][type]" => 'entity_reference_rss_category',
      "fields[taxonomy_" . $this->vocabulary->id() . "][region]" => 'content',
    ];
    $this->submitForm($edit, 'Save');

    // Post an article.
    $edit = [];
    $edit['title[0][value]'] = $this->randomMachineName();
    $edit[$this->fieldName . '[]'] = $term1->id();
    $this->drupalGet('node/add/article');
    $this->submitForm($edit, 'Save');
    $rss_display->setComponent('taxonomy_' . $this->vocabulary->id(), [
      'type' => 'entity_reference_rss_category',
      'region' => 'content',
    ]);
    $rss_display->save();

    // Create an article.
    $node = $this->drupalCreateNode([
      'type' => 'article',
      $this->fieldName => $term1->id(),
    ]);

    // Check that the term is displayed when the RSS feed is viewed.
    $this->drupalGet('rss.xml');
@@ -139,7 +135,6 @@ public function testTaxonomyRss() {
    $view->getDisplay()->overrideOption('arguments', $arguments);
    $view->storage->save();
    // Check the article is shown in the feed.
    $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
    $raw_xml = '<title>' . $node->label() . '</title>';
    $this->drupalGet('taxonomy/term/all/feed');
    $this->assertSession()->responseContains($raw_xml);