Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Commit

Permalink
Add support for Box type version strings containing count & hash of p…
Browse files Browse the repository at this point in the history
…ost-tag commits
  • Loading branch information
padraic committed May 29, 2015
1 parent 843cc2b commit 9f1e755
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/VersionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ private function development($version)
if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
return true;
}
if (1 == preg_match("/-\d+-[a-z0-9]{8,}$/", $version)) {
return true;
}
return false;
}
}
4 changes: 4 additions & 0 deletions tests/Humbug/Test/SelfUpdate/VersionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function testIsStable()
$this->assertTrue($parser->isStable('1.0.0'));
$this->assertFalse($parser->isStable('1.0.0b'));
$this->assertFalse($parser->isStable('1.0.0-dev'));
$this->assertFalse($parser->isStable('1.0.0-alpha1-5-g5b46ad8'));
}

public function testIsPreRelease()
Expand All @@ -145,6 +146,7 @@ public function testIsPreRelease()
$this->assertFalse($parser->isPreRelease('1.0.0'));
$this->assertTrue($parser->isPreRelease('1.0.0b'));
$this->assertFalse($parser->isPreRelease('1.0.0-dev'));
$this->assertFalse($parser->isPreRelease('1.0.0-alpha1-5-g5b46ad8'));
}

public function testIsUnstable()
Expand All @@ -153,6 +155,7 @@ public function testIsUnstable()
$this->assertFalse($parser->isUnstable('1.0.0'));
$this->assertTrue($parser->isUnstable('1.0.0b'));
$this->assertTrue($parser->isUnstable('1.0.0-dev'));
$this->assertTrue($parser->isUnstable('1.0.0-alpha1-5-g5b46ad8'));
}

public function testIsDevelopment()
Expand All @@ -161,5 +164,6 @@ public function testIsDevelopment()
$this->assertFalse($parser->isDevelopment('1.0.0'));
$this->assertFalse($parser->isDevelopment('1.0.0b'));
$this->assertTrue($parser->isDevelopment('1.0.0-dev'));
$this->assertTrue($parser->isDevelopment('1.0.0-alpha1-5-g5b46ad8'));
}
}

0 comments on commit 9f1e755

Please sign in to comment.