You are here

public static function AdvisoriesTestHttpClient::setTestEndpoint in Drupal 9

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 AdvisoriesTestHttpClient::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/AdvisoriesTestHttpClient.php, line 52

Class

AdvisoriesTestHttpClient
Provides a decorator service for the 'http_client' service for testing.

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();
  }
}