function ProjectCoreCompatibilityTest::testIsCoreCompatible

Same name in other branches
  1. 11.x core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php \Drupal\Tests\update\Unit\ProjectCoreCompatibilityTest::testIsCoreCompatible()

@covers ::isCoreCompatible @dataProvider providerIsCoreCompatible

Parameters

string $constraint: The core_version_constraint to test.

string $installed_core: The installed version of core to compare against.

bool $expected: The expected result.

File

core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php, line 170

Class

ProjectCoreCompatibilityTest
@coversDefaultClass \Drupal\update\ProjectCoreCompatibility

Namespace

Drupal\Tests\update\Unit

Code

public function testIsCoreCompatible(string $constraint, string $installed_core, bool $expected) : void {
    $core_data['existing_version'] = $installed_core;
    $project_compatibility = new ProjectCoreCompatibility($core_data, [], []);
    $reflection = new \ReflectionClass(ProjectCoreCompatibility::class);
    $reflection_method = $reflection->getMethod('isCoreCompatible');
    $result = $reflection_method->invokeArgs($project_compatibility, [
        $constraint,
    ]);
    $this->assertSame($expected, $result);
}

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