function SecurityAdvisoriesFetcherTest::setExistingProjectVersion

Same name in other branches
  1. 9 core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php \Drupal\Tests\system\Kernel\SecurityAdvisories\SecurityAdvisoriesFetcherTest::setExistingProjectVersion()
  2. 10 core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php \Drupal\Tests\system\Kernel\SecurityAdvisories\SecurityAdvisoriesFetcherTest::setExistingProjectVersion()

Sets the existing version of the project.

Parameters

string $existing_version: The existing version of the project.

2 calls to SecurityAdvisoriesFetcherTest::setExistingProjectVersion()
SecurityAdvisoriesFetcherTest::testIgnoreAdvisories in core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
Tests advisories that should be ignored.
SecurityAdvisoriesFetcherTest::testShowAdvisories in core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php
Tests contrib advisories that should be displayed.

File

core/modules/system/tests/src/Kernel/SecurityAdvisories/SecurityAdvisoriesFetcherTest.php, line 523

Class

SecurityAdvisoriesFetcherTest
@coversDefaultClass \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher

Namespace

Drupal\Tests\system\Kernel\SecurityAdvisories

Code

protected function setExistingProjectVersion(string $existing_version) : void {
    $module_list = $this->prophesize(ModuleExtensionList::class);
    $extension = $this->prophesize(Extension::class)
        ->reveal();
    $extension->info = [
        'project' => 'the_project',
    ];
    if (!empty($existing_version)) {
        $extension->info['version'] = $existing_version;
    }
    $module_list->getList()
        ->willReturn([
        $extension,
    ]);
    $this->container
        ->set('extension.list.module', $module_list->reveal());
}

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