Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getCurrentRemoteVersion(Updater $updater)
 {
     $versions = array_keys($this->getAvailableVersions());
     if (!$this->allowMajor) {
         $versions = $this->filterByLocalMajorVersion($versions);
     }
     $versionParser = new VersionParser($versions);
     $mostRecent = $versionParser->getMostRecentStable();
     // Look for unstable updates if explicitly allowed, or if the local
     // version is already unstable and there is no new stable version.
     if ($this->allowUnstable || $versionParser->isUnstable($this->localVersion) && version_compare($mostRecent, $this->localVersion, '<')) {
         $mostRecent = $versionParser->getMostRecentAll();
     }
     return version_compare($mostRecent, $this->localVersion, '>') ? $mostRecent : false;
 }
Пример #2
0
 public function testIsUnstable()
 {
     $parser = new VersionParser();
     $this->assertFalse($parser->isUnstable('1.0.0'));
     $this->assertTrue($parser->isUnstable('1.0.0b'));
     $this->assertTrue($parser->isUnstable('1.0.0-dev'));
 }