From 9f1e755c19746e77d15f520c82002d3b0d632b80 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Fri, 29 May 2015 17:47:24 +0100 Subject: [PATCH] Add support for Box type version strings containing count & hash of post-tag commits --- src/VersionParser.php | 3 +++ tests/Humbug/Test/SelfUpdate/VersionParserTest.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/VersionParser.php b/src/VersionParser.php index 69e2fa4..87b1626 100644 --- a/src/VersionParser.php +++ b/src/VersionParser.php @@ -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; } } diff --git a/tests/Humbug/Test/SelfUpdate/VersionParserTest.php b/tests/Humbug/Test/SelfUpdate/VersionParserTest.php index 66761fa..189713a 100644 --- a/tests/Humbug/Test/SelfUpdate/VersionParserTest.php +++ b/tests/Humbug/Test/SelfUpdate/VersionParserTest.php @@ -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() @@ -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() @@ -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() @@ -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')); } }