You are here

public function ModuleVersionTest::testCreateFromSupportBranch in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/update/tests/src/Unit/ModuleVersionTest.php \Drupal\Tests\update\Unit\ModuleVersionTest::testCreateFromSupportBranch()

@covers ::createFromSupportBranch

@dataProvider providerCreateFromSupportBranch

Parameters

string $branch: The branch to test.

string $expected_major: The expected major version.

File

core/modules/update/tests/src/Unit/ModuleVersionTest.php, line 311

Class

ModuleVersionTest
@coversDefaultClass \Drupal\update\ModuleVersion

Namespace

Drupal\Tests\update\Unit

Code

public function testCreateFromSupportBranch($branch, $expected_major) {
  $version = ModuleVersion::createFromSupportBranch($branch);
  $this
    ->assertInstanceOf(ModuleVersion::class, $version);
  $this
    ->assertSame($expected_major, $version
    ->getMajorVersion());

  // Version extra can't be determined from a branch.
  $this
    ->assertSame(NULL, $version
    ->getVersionExtra());
}