function DevReleaseTest::setReleaseMetadata

Same name in other branches
  1. 10 core/modules/update/tests/src/Kernel/DevReleaseTest.php \Drupal\Tests\update\Kernel\DevReleaseTest::setReleaseMetadata()

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

Parameters

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

1 call to DevReleaseTest::setReleaseMetadata()
DevReleaseTest::setUp in core/modules/update/tests/src/Kernel/DevReleaseTest.php

File

core/modules/update/tests/src/Kernel/DevReleaseTest.php, line 66

Class

DevReleaseTest
Tests the project data when the installed version is a dev version.

Namespace

Drupal\Tests\update\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);
}

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