class SemVerTest

@coversDefaultClass \Drupal\Composer\Plugin\RecipeUnpack\SemVer

@group Unpack

Hierarchy

  • class \Drupal\Tests\Composer\Plugin\Unpack\SemVerTest extends \PHPUnit\Framework\TestCase

Expanded class hierarchy of SemVerTest

File

core/tests/Drupal/Tests/Composer/Plugin/Unpack/SemVerTest.php, line 16

Namespace

Drupal\Tests\Composer\Plugin\Unpack
View source
class SemVerTest extends TestCase {
    
    /**
     * @testWith ["^6.1", "^6.3", "^6.3"]
     *           ["*", "^6.3", "^6.3"]
     *           ["^6@dev", "^6.3", "^6.3"]
     *
     * @covers ::minimizeConstraints
     */
    public function testMinimizeConstraints(string $constraint_a, string $constraint_b, string $expected) : void {
        $version_parser = new VersionParser();
        $this->assertSame($expected, SemVer::minimizeConstraints($version_parser, $constraint_a, $constraint_b));
        $this->assertSame($expected, SemVer::minimizeConstraints($version_parser, $constraint_b, $constraint_a));
    }
    
    /**
     * @testWith ["^6.1 || ^4.0", "^6.3 || ^7.4", ">=6.3.0.0-dev, <7.0.0.0-dev"]
     *
     * @covers ::minimizeConstraints
     */
    public function testMinimizeConstraintsWhichAreNotSubsets(string $constraint_a, string $constraint_b, string $expected) : void {
        $this->assertSame($expected, SemVer::minimizeConstraints(new VersionParser(), $constraint_a, $constraint_b));
    }
    
    /**
     * @testWith ["^6.1", "^5.1", ">=6.3.0.0-dev, <7.0.0.0-dev"]
     *
     * @covers ::minimizeConstraints
     */
    public function testMinimizeConstraintsWhichDoNotIntersect(string $constraint_a, string $constraint_b, string $expected) : void {
        $this->expectException(\LogicException::class);
        $this->expectExceptionMessage('The constraints "^6.1" and "^5.1" do not intersect and cannot be minimized.');
        $this->assertSame($expected, SemVer::minimizeConstraints(new VersionParser(), $constraint_a, $constraint_b));
    }

}

Members

Title Sort descending Modifiers Object type Summary
SemVerTest::testMinimizeConstraints public function @testWith [&quot;^6.1&quot;, &quot;^6.3&quot;, &quot;^6.3&quot;]
[&quot;*&quot;, &quot;^6.3&quot;, &quot;^6.3&quot;]
[&quot;^6@dev&quot;, &quot;^6.3&quot;, &quot;^6.3&quot;]
SemVerTest::testMinimizeConstraintsWhichAreNotSubsets public function @testWith [&quot;^6.1 || ^4.0&quot;, &quot;^6.3 || ^7.4&quot;, &quot;&gt;=6.3.0.0-dev, &lt;7.0.0.0-dev&quot;]
SemVerTest::testMinimizeConstraintsWhichDoNotIntersect public function @testWith [&quot;^6.1&quot;, &quot;^5.1&quot;, &quot;&gt;=6.3.0.0-dev, &lt;7.0.0.0-dev&quot;]

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