function AnnounceFetcherTest::testFeedFields

Same name in other branches
  1. 10 core/modules/announcements_feed/tests/src/Kernel/AnnounceFetcherTest.php \Drupal\Tests\announcements_feed\Kernel\AnnounceFetcherTest::testFeedFields()

Tests feed fields.

File

core/modules/announcements_feed/tests/src/Kernel/AnnounceFetcherTest.php, line 47

Class

AnnounceFetcherTest
@coversDefaultClass \Drupal\announcements_feed\AnnounceFetcher

Namespace

Drupal\Tests\announcements_feed\Kernel

Code

public function testFeedFields() : void {
    $this->markTestSkipped('Skipped due to major version-specific logic. See https://www.drupal.org/project/drupal/issues/3359322');
    $feed_item_1 = [
        'id' => '1001',
        'content_html' => 'Test teaser 1',
        'url' => 'https://www.drupal.org/project/announce',
        '_drupalorg' => [
            'featured' => TRUE,
            'version' => '^10',
        ],
        'date_modified' => "2021-09-02T15:09:42+00:00",
        'date_published' => "2021-09-01T15:09:42+00:00",
    ];
    $this->setFeedItems([
        $feed_item_1,
    ]);
    $feeds = $this->fetchFeedItems();
    $this->assertCount(1, $feeds);
    $this->assertSame($feed_item_1['id'], $feeds[0]->id);
    $this->assertSame($feed_item_1['content_html'], $feeds[0]->content_html);
    $this->assertSame($feed_item_1['_drupalorg']['featured'], $feeds[0]->featured);
    $this->assertSame($feed_item_1['date_published'], $feeds[0]->date_published);
    $this->assertSame($feed_item_1['_drupalorg']['version'], $feeds[0]->version);
}

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