testFindBestMatchingVersion()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Mouf\NodeJsInstaller;
3
4
class NodeJsVersionMatcherTest extends \PHPUnit\Framework\TestCase
5
{
6
7
    public function testIsVersionMatching()
8
    {
9
        $matcher = new NodeJsVersionMatcher();
10
        $this->assertTrue($matcher->isVersionMatching('0.12.0', '~0.11'));
11
        $this->assertFalse($matcher->isVersionMatching('0.12.0', '~0.11.0'));
12
        $this->assertTrue($matcher->isVersionMatching('0.12.0', '~0.11, <1.0'));
13
        $this->assertFalse($matcher->isVersionMatching('0.12.0', '~0.11, <1.0, >1.1'));
14
    }
15
16
    public function testFindBestMatchingVersion()
17
    {
18
        $matcher = new NodeJsVersionMatcher();
19
        $this->assertEquals("0.12.0", $matcher->findBestMatchingVersion(['0.11.1', '0.12.0', '0.10', '0.11.5'], '~0.11'));
20
    }
21
}
22