function ExtensionVersionTest::testCreateFromSupportBranch

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Extension/ExtensionVersionTest.php \Drupal\Tests\Core\Extension\ExtensionVersionTest::testCreateFromSupportBranch()
  2. 11.x core/tests/Drupal/Tests/Core/Extension/ExtensionVersionTest.php \Drupal\Tests\Core\Extension\ExtensionVersionTest::testCreateFromSupportBranch()

@covers ::createFromSupportBranch

@dataProvider providerCreateFromSupportBranch

Parameters

string $branch: The branch to test.

string $expected_major: The expected major version.

File

core/tests/Drupal/Tests/Core/Extension/ExtensionVersionTest.php, line 355

Class

ExtensionVersionTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ExtensionVersion.php/class/ExtensionVersion/9" title="Provides an extension version value object." class="local">\Drupal\Core\Extension\ExtensionVersion</a>

Namespace

Drupal\Tests\Core\Extension

Code

public function testCreateFromSupportBranch(string $branch, string $expected_major) : void {
    $version = ExtensionVersion::createFromSupportBranch($branch);
    $this->assertInstanceOf(ExtensionVersion::class, $version);
    $this->assertSame($expected_major, $version->getMajorVersion());
    // Version extra can't be determined from a branch.
    $this->assertSame(NULL, $version->getVersionExtra());
}

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