function UpdateCalculateProjectDataTest::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 UpdateCalculateProjectDataTest::setReleaseMetadata()
UpdateCalculateProjectDataTest::testProjectStatus in core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php
Tests the project_status of the project.

File

core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php, line 68

Class

UpdateCalculateProjectDataTest
Test the values set in <a href="/api/drupal/core%21modules%21update%21update.compare.inc/function/update_calculate_project_data/11.x" title="Calculates the current update status of all projects on the site." class="local">update_calculate_project_data</a>().

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.