Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Closes #32: Replace (string) casting with (array) in
version::getPrerelease().

* 'master' of https://github.com/Pheromone/php-semver:
  Replace (string) casting with (array) in version::getPrerelease().
  • Loading branch information
vierbergenlars committed Dec 21, 2013
2 parents dce0f3c + dd15549 commit 2bc4918
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vierbergenlars/SemVer/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getBuild()
*/
public function getPrerelease()
{
return (string) $this->version->prerelease->valueOf();
return (array) $this->version->prerelease->valueOf();
}

/**
Expand Down
14 changes: 14 additions & 0 deletions tests/base_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,18 @@ function testNoShitAsVersion()
new SemVer\version($version);
}
}
function testPrerelease()
{
$t = array(
'1.0.0-alpha'=>array('alpha'),
'1.0.0-alpha.1'=>array('alpha', '1'),
'1.0.0-0.3.7'=>array('0', '3', '7'),
'1.0.0-x.7.z.92'=>array('x', '7', 'z', '92'),
);
foreach($t as $version => $prerelease) {
$v=new SemVer\version($version);
$this->assertEqual($v->getPrerelease(), $prerelease);
}
}

}

0 comments on commit 2bc4918

Please sign in to comment.