buildFetchUrl example


  public function testUpdateBuildFetchUrl(array $project$site_key$expected) {
    $url = $this->updateFetcher->buildFetchUrl($project$site_key);
    $this->assertEquals($url$expected);
    $this->assertFalse($this->logger->hasErrorRecords());
  }

  /** * Provide test data for self::testUpdateBuildFetchUrl(). * * @return array * An array of arrays, each containing: * - 'project' - An array matching a project's .info file structure. * - 'site_key' - An arbitrary site key. * - 'expected' - The expected URL from UpdateFetcher::buildFetchUrl(). */
$this->withHttpFallback = $settings->get('update_fetch_with_http_fallback', FALSE);
    if ($this->logger === NULL) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
      $this->logger = \Drupal::service('logger.channel.update');
    }
  }

  /** * {@inheritdoc} */
  public function fetchProjectData(array $project$site_key = '') {
    $url = $this->buildFetchUrl($project$site_key);
    return $this->doRequest($url['headers' => ['Accept' => 'text/xml']]$this->withHttpFallback);
  }

  /** * Applies a GET request with a possible HTTP fallback. * * This method falls back to HTTP in case there was some certificate * problem. * * @param string $url * The URL. * @param array $options * The guzzle client options. * @param bool $with_http_fallback * Should the function fall back to HTTP. * * @return string * The body of the HTTP(S) request, or an empty string on failure. */
Home | Imprint | This part of the site doesn't use cookies.