setTestFeedResponses example


  protected function setFeedItems(array $feed_items): void {
    $responses = [];
    foreach ($feed_items as $feed_item) {
      $feed_item += [
        'title' => 'Drupal security update Test',
        'url' => 'https://www.drupal.org/project/announce',
      ];
      $responses[] = new Response(200, []json_encode(['items' => [$feed_item]]));
    }
    $this->setTestFeedResponses($responses);
  }

  /** * Gets the announcements from the 'announce.fetcher' service. * * @return \Drupal\announcements_feed\Announcement[] * The return value of AnnounceFetcher::fetch(). */
  protected function fetchFeedItems(): array {
    return $this->container->get('announcements_feed.fetcher')->fetch();
  }

}

  protected function setFeedItems(array $feed_items): void {
    $responses = [];
    foreach ($feed_items as $feed_item) {
      $feed_item += [
        'title' => 'SA title',
        'link' => 'http://example.com',
      ];
      $responses[] = new Response('200', []json_encode([$feed_item]));
    }
    $this->setTestFeedResponses($responses);
  }

  /** * Sets the existing version of the project. * * @param string $existing_version * The existing version of the project. */
  protected function setExistingProjectVersion(string $existing_version): void {
    $module_list = $this->prophesize(ModuleExtensionList::class);
    $extension = $this->prophesize(Extension::class)->reveal();
    

  protected function setFeedItems(array $feed_items): void {
    $responses = [];
    foreach ($feed_items as $feed_item) {
      $feed_item += [
        'title' => 'Drupal security update Test',
        'url' => 'https://www.drupal.org/project/announce',
      ];
      $responses[] = new Response(200, []json_encode(['items' => [$feed_item]]));
    }
    $this->setTestFeedResponses($responses);
  }

  /** * Sets test feed responses. * * @param \GuzzleHttp\Psr7\Response[] $responses * The responses for the http_client service to return. */
  protected function setTestFeedResponses(array $responses): void {
    // Create a mock and queue responses.     $mock = new MockHandler($responses);
    

  protected function setFeedItems(array $feed_items): void {
    $responses[] = new Response(200, []json_encode(['items' => $feed_items]));
    $responses[] = new Response(200, []json_encode(['items' => $feed_items]));
    $responses[] = new Response(200, []json_encode(['items' => $feed_items]));

    $this->setTestFeedResponses($responses);
  }

}
Home | Imprint | This part of the site doesn't use cookies.