function AdvisoryTestClientMiddleware::setTestEndpoint

Same name in other branches
  1. 11.x core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php \Drupal\advisory_feed_test\AdvisoryTestClientMiddleware::setTestEndpoint()

Sets the test endpoint for the advisories JSON feed.

Parameters

string $test_endpoint: The test endpoint.

bool $delete_stored_response: Whether to delete stored feed response.

1 call to AdvisoryTestClientMiddleware::setTestEndpoint()
SecurityAdvisoryTest::testPsa in core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php
Tests that a security advisory is displayed.

File

core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php, line 40

Class

AdvisoryTestClientMiddleware
Overrides the User-Agent HTTP header for outbound HTTP requests.

Namespace

Drupal\advisory_feed_test

Code

public static function setTestEndpoint(string $test_endpoint, bool $delete_stored_response = FALSE) : void {
    \Drupal::state()->set('advisories_test_endpoint', $test_endpoint);
    if ($delete_stored_response) {
        \Drupal::service('system.sa_fetcher')->deleteStoredResponse();
    }
}

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