You are here

protected function AutomaticUpdatesKernelTestBase::setReleaseMetadata in Automatic Updates 8.2

Sets the release metadata file to use when fetching available updates.

Parameters

string $file: The path of the XML metadata file to use.

3 calls to AutomaticUpdatesKernelTestBase::setReleaseMetadata()
AutomaticUpdatesKernelTestBase::setUp in tests/src/Kernel/AutomaticUpdatesKernelTestBase.php
CronUpdaterTest::testUpdaterCalled in tests/src/Kernel/CronUpdaterTest.php
Tests that the cron handler calls the updater as expected.
UpdaterTest::testCorrectVersionsStaged in tests/src/Kernel/UpdaterTest.php
Tests that correct versions are staged after calling ::begin().

File

tests/src/Kernel/AutomaticUpdatesKernelTestBase.php, line 103

Class

AutomaticUpdatesKernelTestBase
Base class for kernel tests of the Automatic Updates module.

Namespace

Drupal\Tests\automatic_updates\Kernel

Code

protected function setReleaseMetadata(string $file) : void {
  $metadata = Utils::tryFopen($file, 'r');
  $response = new Response(200, [], Utils::streamFor($metadata));
  $handler = new MockHandler([
    $response,
  ]);
  $this->client = new Client([
    'handler' => HandlerStack::create($handler),
  ]);
  $this->container
    ->set('http_client', $this->client);
}