function AnnounceRendererTest::testRendererException

Same name in other branches
  1. 11.x core/modules/announcements_feed/tests/src/Kernel/AnnounceRendererTest.php \Drupal\Tests\announcements_feed\Kernel\AnnounceRendererTest::testRendererException()

Tests rendered valid when something goes wrong.

File

core/modules/announcements_feed/tests/src/Kernel/AnnounceRendererTest.php, line 19

Class

AnnounceRendererTest
@coversDefaultClass \Drupal\announcements_feed\AnnounceRenderer

Namespace

Drupal\Tests\announcements_feed\Kernel

Code

public function testRendererException() : void {
    $this->setTestFeedResponses([
        new Response(403),
    ]);
    $render = $this->container
        ->get('announcements_feed.renderer')
        ->render();
    $this->assertEquals('status_messages', $render['#theme']);
    $this->assertEquals('An error occurred while parsing the announcements feed, check the logs for more information.', $render['#message_list']['error'][0]);
}

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