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

Commit

Permalink
Replace (string) casting with (array) in version::getPrerelease().
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Buyle committed Dec 20, 2013
1 parent dce0f3c commit dd15549
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 dd15549

Please sign in to comment.