function UpdateCalculateProjectDataTest::setReleaseMetadata

Same name in other branches
  1. 11.x core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php \Drupal\Tests\update\Kernel\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 update_calculate_project_data().

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.