function RssResponseRelativeUrlFilterTest::testOnResponse

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php \Drupal\Tests\Core\EventSubscriber\RssResponseRelativeUrlFilterTest::testOnResponse()
  2. 10 core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php \Drupal\Tests\Core\EventSubscriber\RssResponseRelativeUrlFilterTest::testOnResponse()
  3. 11.x core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php \Drupal\Tests\Core\EventSubscriber\RssResponseRelativeUrlFilterTest::testOnResponse()

@dataProvider providerTestOnResponse

Parameters

string $content:

string $expected_content:

File

core/tests/Drupal/Tests/Core/EventSubscriber/RssResponseRelativeUrlFilterTest.php, line 113

Class

RssResponseRelativeUrlFilterTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21EventSubscriber%21RssResponseRelativeUrlFilter.php/class/RssResponseRelativeUrlFilter/8.9.x" title="Subscribes to filter RSS responses, to make relative URIs absolute." class="local">\Drupal\Core\EventSubscriber\RssResponseRelativeUrlFilter</a> @group event_subscriber

Namespace

Drupal\Tests\Core\EventSubscriber

Code

public function testOnResponse($content, $expected_content) {
    $event = new FilterResponseEvent($this->prophesize(HttpKernelInterface::class)
        ->reveal(), Request::create('/'), HttpKernelInterface::MASTER_REQUEST, new Response($content, 200, [
        'Content-Type' => 'application/rss+xml',
    ]));
    $url_filter = new RssResponseRelativeUrlFilter();
    $url_filter->onResponse($event);
    $this->assertEquals($expected_content, $event->getResponse()
        ->getContent());
}

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