You are here

public function ModuleVersionTest::testCreateFromSupportBranch in Drupal 8

Same name and namespace in other branches
  1. 9 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 310

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());
}