function AdvisoriesTestHttpClient::get

File

core/modules/system/tests/modules/advisory_feed_test/src/AdvisoriesTestHttpClient.php, line 33

Class

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

Namespace

Drupal\advisory_feed_test

Code

public function get($uri, array $options = []) : ResponseInterface {
    $test_end_point = \Drupal::state()->get('advisories_test_endpoint');
    if ($test_end_point && strpos($uri, '://updates.drupal.org/psa.json') !== FALSE) {
        // Only override $uri if it matches the advisories JSON feed to avoid
        // changing any other uses of the 'http_client' service during tests with
        // this module installed.
        $uri = $test_end_point;
    }
    return $this->innerClient
        ->get($uri, $options);
}

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