/**
  * @dataProvider provideIsSameVersionDataset
  *
  * @covers ::calculate
  */
 public function testCanCallStatically($a, $b, $expectedResult)
 {
     // ----------------------------------------------------------------
     // setup your test
     $aVer = ParseSemanticVersion::from($a);
     $bVer = ParseSemanticVersion::from($b);
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = SameVersion::calculate($aVer, $bVer);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedResult, $actualResult);
 }
Ejemplo n.º 2
0
 /**
  * is $a a pre-release of $b?
  *
  * @param  VersionNumber|string $a
  *         the LHS of this calculation
  * @param  VersionNumber|string $b
  *         the RHS of this calculation
  * @param  VersionParser|null $parser
  *         the parser to use if $a or $b are strings
  * @return boolean
  *         TRUE if $a < $b
  *         FALSE otherwise
  */
 public static function calculate($a, $b, VersionParser $parser = null)
 {
     $aObj = EnsureVersionNumber::from($a, $parser);
     $bObj = EnsureCompatibleVersionNumber::from($aObj, $b, $parser);
     // quickest test of all ... is $a a pre-release?
     if (!$aObj->hasPreRelease()) {
         return false;
     }
     return SameVersion::calculate($aObj, $bObj);
 }