NodeJsVersionMatcherTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsVersionMatching() 0 8 1
A testFindBestMatchingVersion() 0 5 1
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