/** * @dataProvider provideSmallerGreaterVersions * @param SemanticVersionInterface $smaller * @param SemanticVersionInterface $greater */ public function testNotEqualComparison(SemanticVersionInterface $smaller, SemanticVersionInterface $greater) { $comparator = new SemanticComparator(); $this->assertTrue($comparator->compare($smaller, $greater) < 0, "{$smaller} < {$greater}"); $this->assertTrue($comparator->compare($greater, $smaller) > 0, "{$greater} > {$smaller}"); $this->assertTrue($comparator($smaller, $greater) < 0, "{$smaller} < {$greater}"); $this->assertTrue($comparator($greater, $smaller) > 0, "{$greater} > {$smaller}"); }
public function testCompare() { $comparator = new SemanticComparator(); $alpha = new SemanticVersion('1.0.0-alpha'); $candidate = new SemanticVersion('1.0.0-rc.1'); $candidate_meta = new SemanticVersion('1.0.0-rc.1+ci'); $release = new SemanticVersion('1.0.0'); // $alpha < $candidate assert($comparator($alpha, $candidate) < 0); assert($comparator->compare($alpha, $candidate) < 0); // $candidate == $candidate_meta assert($comparator($candidate, $candidate_meta) == 0); assert($comparator->compare($candidate, $candidate_meta) == 0); // $release > $candidate assert($comparator($release, $candidate) > 0); assert($comparator->compare($release, $candidate) > 0); }