Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
44
vendor/phar-io/version/CHANGELOG.md
vendored
Normal file
44
vendor/phar-io/version/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [2.0.1] - 08.07.2018
|
||||
|
||||
### Fixed
|
||||
|
||||
- Versions without a pre-release suffix are now always considered greater
|
||||
than versions without a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1`
|
||||
|
||||
## [2.0.0] - 23.06.2018
|
||||
|
||||
Changes to public API:
|
||||
|
||||
- `PreReleaseSuffix::construct()`: optional parameter `$number` removed
|
||||
- `PreReleaseSuffix::isGreaterThan()`: introduced
|
||||
- `Version::hasPreReleaseSuffix()`: introduced
|
||||
|
||||
### Added
|
||||
|
||||
- [#11](https://github.com/phar-io/version/issues/11): Added support for pre-release version suffixes. Supported values are:
|
||||
- `dev`
|
||||
- `beta` (also abbreviated form `b`)
|
||||
- `rc`
|
||||
- `alpha` (also abbreviated form `a`)
|
||||
- `patch` (also abbreviated form `p`)
|
||||
|
||||
All values can be followed by a number, e.g. `beta3`.
|
||||
|
||||
When comparing versions, the pre-release suffix is taken into account. Example:
|
||||
`1.5.0 > 1.5.0-beta1 > 1.5.0-alpha3 > 1.5.0-alpha2 > 1.5.0-dev11`
|
||||
|
||||
### Changed
|
||||
|
||||
- reorganized the source directories
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#10](https://github.com/phar-io/version/issues/10): Version numbers containing
|
||||
a numeric suffix as seen in Debian packages are now supported.
|
||||
|
||||
[2.0.1]: https://github.com/phar-io/version/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/phar-io/version/compare/1.0.1...2.0.0
|
||||
45
vendor/phar-io/version/README.md
vendored
45
vendor/phar-io/version/README.md
vendored
@@ -14,3 +14,48 @@ If you only need this library during development, for instance to run your proje
|
||||
|
||||
composer require --dev phar-io/version
|
||||
|
||||
## Version constraints
|
||||
|
||||
A Version constraint describes a range of versions or a discrete version number. The format of version numbers follows the schema of [semantic versioning](http://semver.org): `<major>.<minor>.<patch>`. A constraint might contain an operator that describes the range.
|
||||
|
||||
Beside the typical mathematical operators like `<=`, `>=`, there are two special operators:
|
||||
|
||||
*Caret operator*: `^1.0`
|
||||
can be written as `>=1.0.0 <2.0.0` and read as »every Version within major version `1`«.
|
||||
|
||||
*Tilde operator*: `~1.0.0`
|
||||
can be written as `>=1.0.0 <1.1.0` and read as »every version within minor version `1.1`. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: `~1.0` is identical to `^1.0`.
|
||||
|
||||
## Usage examples
|
||||
|
||||
Parsing version constraints and check discrete versions for compliance:
|
||||
|
||||
```php
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use PharIo\Version\VersionConstraintParser;
|
||||
|
||||
$parser = new VersionConstraintParser();
|
||||
$caret_constraint = $parser->parse( '^7.0' );
|
||||
|
||||
$caret_constraint->complies( new Version( '7.0.17' ) ); // true
|
||||
$caret_constraint->complies( new Version( '7.1.0' ) ); // true
|
||||
$caret_constraint->complies( new Version( '6.4.34' ) ); // false
|
||||
|
||||
$tilde_constraint = $parser->parse( '~1.1.0' );
|
||||
|
||||
$tilde_constraint->complies( new Version( '1.1.4' ) ); // true
|
||||
$tilde_constraint->complies( new Version( '1.2.0' ) ); // false
|
||||
```
|
||||
|
||||
As of version 2.0.0, pre-release labels are supported and taken into account when comparing versions:
|
||||
|
||||
```php
|
||||
|
||||
$leftVersion = new PharIo\Version\Version('3.0.0-alpha.1');
|
||||
$rightVersion = new PharIo\Version\Version('3.0.0-alpha.2');
|
||||
|
||||
$leftVersion->isGreaterThan($rightVersion); // false
|
||||
$rightVersion->isGreaterThan($leftVersion); // true
|
||||
|
||||
```
|
||||
|
||||
80
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
80
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
@@ -1,8 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class PreReleaseSuffix
|
||||
{
|
||||
class PreReleaseSuffix {
|
||||
private $valueScoreMap = [
|
||||
'dev' => 0,
|
||||
'a' => 1,
|
||||
'alpha' => 1,
|
||||
'b' => 2,
|
||||
'beta' => 2,
|
||||
'rc' => 3,
|
||||
'p' => 4,
|
||||
'patch' => 4,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -11,31 +22,74 @@ class PreReleaseSuffix
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $number;
|
||||
private $valueScore;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param int|null $number
|
||||
* @var int
|
||||
*/
|
||||
public function __construct($value, $number = null)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->number = $number;
|
||||
private $number = 0;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct($value) {
|
||||
$this->parseValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
public function getNumber() {
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PreReleaseSuffix $suffix
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGreaterThan(PreReleaseSuffix $suffix) {
|
||||
if ($this->valueScore > $suffix->valueScore) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->valueScore < $suffix->valueScore) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->getNumber() > $suffix->getNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function mapValueToScore($value) {
|
||||
if (array_key_exists($value, $this->valueScoreMap)) {
|
||||
return $this->valueScoreMap[$value];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function parseValue($value) {
|
||||
$regex = '/-?(dev|beta|b|rc|alpha|a|patch|p)\.?(\d*).*$/i';
|
||||
if (preg_match($regex, $value, $matches) !== 1) {
|
||||
throw new InvalidPreReleaseSuffixException(sprintf('Invalid label %s', $value));
|
||||
}
|
||||
|
||||
$this->value = $matches[1];
|
||||
if (isset($matches[2])) {
|
||||
$this->number = (int)$matches[2];
|
||||
}
|
||||
$this->valueScore = $this->mapValueToScore($this->value);
|
||||
}
|
||||
}
|
||||
|
||||
59
vendor/phar-io/version/src/Version.php
vendored
59
vendor/phar-io/version/src/Version.php
vendored
@@ -45,26 +45,10 @@ class Version {
|
||||
$this->versionString = $versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $matches
|
||||
*/
|
||||
private function parseVersion(array $matches) {
|
||||
$this->major = new VersionNumber($matches['Major']);
|
||||
$this->minor = new VersionNumber($matches['Minor']);
|
||||
$this->patch = isset($matches['Patch']) ? new VersionNumber($matches['Patch']) : new VersionNumber(null);
|
||||
|
||||
if (isset($matches['ReleaseType'])) {
|
||||
$preReleaseNumber = isset($matches['ReleaseTypeCount']) ? (int) $matches['ReleaseTypeCount'] : null;
|
||||
|
||||
$this->preReleaseSuffix = new PreReleaseSuffix($matches['ReleaseType'], $preReleaseNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PreReleaseSuffix
|
||||
*/
|
||||
public function getPreReleaseSuffix()
|
||||
{
|
||||
public function getPreReleaseSuffix() {
|
||||
return $this->preReleaseSuffix;
|
||||
}
|
||||
|
||||
@@ -75,6 +59,13 @@ class Version {
|
||||
return $this->versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreReleaseSuffix() {
|
||||
return $this->preReleaseSuffix !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
@@ -97,7 +88,7 @@ class Version {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($version->getPatch()->getValue() >= $this->getPatch()->getValue()) {
|
||||
if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -105,7 +96,19 @@ class Version {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,6 +132,19 @@ class Version {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $matches
|
||||
*/
|
||||
private function parseVersion(array $matches) {
|
||||
$this->major = new VersionNumber($matches['Major']);
|
||||
$this->minor = new VersionNumber($matches['Minor']);
|
||||
$this->patch = isset($matches['Patch']) ? new VersionNumber($matches['Patch']) : new VersionNumber(null);
|
||||
|
||||
if (isset($matches['PreReleaseSuffix'])) {
|
||||
$this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*
|
||||
@@ -144,10 +160,7 @@ class Version {
|
||||
)?
|
||||
(?:
|
||||
-
|
||||
(?<ReleaseType>(?:(dev|beta|b|RC|alpha|a|patch|p)))
|
||||
(?:
|
||||
(?<ReleaseTypeCount>[0-9])
|
||||
)?
|
||||
(?<PreReleaseSuffix>(?:(dev|beta|b|RC|alpha|a|patch|p)\.?\d*))
|
||||
)?
|
||||
$/x';
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class VersionConstraintParser {
|
||||
return $this->handleOrGroup($value);
|
||||
}
|
||||
|
||||
if (!preg_match('/^[\^~\*]?[\d.\*]+$/', $value)) {
|
||||
if (!preg_match('/^[\^~\*]?[\d.\*]+(?:-.*)?$/', $value)) {
|
||||
throw new UnsupportedVersionConstraintException(
|
||||
sprintf('Version constraint %s is not supported.', $value)
|
||||
);
|
||||
@@ -45,20 +45,20 @@ class VersionConstraintParser {
|
||||
|
||||
if ($version->getMinor()->isAny()) {
|
||||
return new SpecificMajorVersionConstraint(
|
||||
$value,
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
return new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
return new ExactVersionConstraint($value);
|
||||
return new ExactVersionConstraint($version->getVersionString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ class VersionConstraintParser {
|
||||
* @return AndVersionConstraintGroup
|
||||
*/
|
||||
private function handleTildeOperator($value) {
|
||||
$version = new Version(substr($value, 1));
|
||||
$version = new Version(substr($value, 1));
|
||||
$constraints = [
|
||||
new GreaterThanOrEqualToVersionConstraint($value, $version)
|
||||
];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class VersionConstraintValue
|
||||
{
|
||||
class VersionConstraintValue {
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
@@ -42,43 +42,6 @@ class VersionConstraintValue
|
||||
$this->parseVersion($versionString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $versionString
|
||||
*/
|
||||
private function parseVersion($versionString) {
|
||||
$this->extractBuildMetaData($versionString);
|
||||
$this->extractLabel($versionString);
|
||||
|
||||
$versionSegments = explode('.', $versionString);
|
||||
$this->major = new VersionNumber($versionSegments[0]);
|
||||
|
||||
$minorValue = isset($versionSegments[1]) ? $versionSegments[1] : null;
|
||||
$patchValue = isset($versionSegments[2]) ? $versionSegments[2] : null;
|
||||
|
||||
$this->minor = new VersionNumber($minorValue);
|
||||
$this->patch = new VersionNumber($patchValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractBuildMetaData(&$versionString) {
|
||||
if (preg_match('/\+(.*)/', $versionString, $matches) == 1) {
|
||||
$this->buildMetaData = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractLabel(&$versionString) {
|
||||
if (preg_match('/\-(.*)/', $versionString, $matches) == 1) {
|
||||
$this->label = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -120,4 +83,41 @@ class VersionConstraintValue
|
||||
public function getPatch() {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $versionString
|
||||
*/
|
||||
private function parseVersion($versionString) {
|
||||
$this->extractBuildMetaData($versionString);
|
||||
$this->extractLabel($versionString);
|
||||
|
||||
$versionSegments = explode('.', $versionString);
|
||||
$this->major = new VersionNumber($versionSegments[0]);
|
||||
|
||||
$minorValue = isset($versionSegments[1]) ? $versionSegments[1] : null;
|
||||
$patchValue = isset($versionSegments[2]) ? $versionSegments[2] : null;
|
||||
|
||||
$this->minor = new VersionNumber($minorValue);
|
||||
$this->patch = new VersionNumber($patchValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractBuildMetaData(&$versionString) {
|
||||
if (preg_match('/\+(.*)/', $versionString, $matches) == 1) {
|
||||
$this->buildMetaData = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractLabel(&$versionString) {
|
||||
if (preg_match('/\-(.*)/', $versionString, $matches) == 1) {
|
||||
$this->label = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class AndVersionConstraintGroup extends AbstractVersionConstraint {
|
||||
private $constraints = [];
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param string $originalValue
|
||||
* @param VersionConstraint[] $constraints
|
||||
*/
|
||||
public function __construct($originalValue, array $constraints) {
|
||||
@@ -17,7 +17,7 @@ class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {
|
||||
private $minimalVersion;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param string $originalValue
|
||||
* @param Version $minimalVersion
|
||||
*/
|
||||
public function __construct($originalValue, Version $minimalVersion) {
|
||||
@@ -32,7 +32,7 @@ class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
return $version->getVersionString() == $this->minimalVersion->getVersionString() ||
|
||||
$version->isGreaterThan($this->minimalVersion);
|
||||
return $version->getVersionString() == $this->minimalVersion->getVersionString()
|
||||
|| $version->isGreaterThan($this->minimalVersion);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class OrVersionConstraintGroup extends AbstractVersionConstraint {
|
||||
private $constraints = [];
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param string $originalValue
|
||||
* @param VersionConstraint[] $constraints
|
||||
*/
|
||||
public function __construct($originalValue, array $constraints) {
|
||||
@@ -23,8 +23,8 @@ class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint {
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
*/
|
||||
public function __construct($originalValue, $major, $minor) {
|
||||
parent::__construct($originalValue);
|
||||
@@ -18,7 +18,7 @@ class SpecificMajorVersionConstraint extends AbstractVersionConstraint {
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
* @param int $major
|
||||
*/
|
||||
public function __construct($originalValue, $major) {
|
||||
parent::__construct($originalValue);
|
||||
7
vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php
vendored
Normal file
7
vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class InvalidPreReleaseSuffixException extends \Exception implements Exception {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class InvalidVersionException extends \InvalidArgumentException implements Exception {
|
||||
@@ -19,7 +19,7 @@ class VersionConstraintParserTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider versionStringProvider
|
||||
*
|
||||
* @param string $versionString
|
||||
* @param string $versionString
|
||||
* @param VersionConstraint $expectedConstraint
|
||||
*/
|
||||
public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint) {
|
||||
@@ -109,6 +109,27 @@ class VersionConstraintParserTest extends TestCase {
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
['7.0.28-1', new ExactVersionConstraint('7.0.28-1')],
|
||||
[
|
||||
'^3.0.0-alpha1',
|
||||
new AndVersionConstraintGroup(
|
||||
'^3.0.0-alpha1',
|
||||
[
|
||||
new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha1', new Version('3.0.0-alpha1')),
|
||||
new SpecificMajorVersionConstraint('^3.0.0-alpha1', 3)
|
||||
]
|
||||
)
|
||||
],
|
||||
[
|
||||
'^3.0.0-alpha.1',
|
||||
new AndVersionConstraintGroup(
|
||||
'^3.0.0-alpha.1',
|
||||
[
|
||||
new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha.1', new Version('3.0.0-alpha.1')),
|
||||
new SpecificMajorVersionConstraint('^3.0.0-alpha.1', 3)
|
||||
]
|
||||
)
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\AndVersionConstraintGroup
|
||||
* @covers \PharIo\Version\AndVersionConstraintGroup
|
||||
*/
|
||||
class AndVersionConstraintGroupTest extends TestCase {
|
||||
public function testReturnsFalseIfOneConstraintReturnsFalse() {
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$secondConstraint = $this->createMock(VersionConstraint::class);
|
||||
|
||||
$firstConstraint->expects($this->once())
|
||||
@@ -34,7 +34,7 @@ class AndVersionConstraintGroupTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testReturnsTrueIfAllConstraintsReturnsTrue() {
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$secondConstraint = $this->createMock(VersionConstraint::class);
|
||||
|
||||
$firstConstraint->expects($this->once())
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\AnyVersionConstraint
|
||||
* @covers \PharIo\Version\AnyVersionConstraint
|
||||
*/
|
||||
class AnyVersionConstraintTest extends TestCase {
|
||||
public function versionProvider() {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\ExactVersionConstraint
|
||||
* @covers \PharIo\Version\ExactVersionConstraint
|
||||
*/
|
||||
class ExactVersionConstraintTest extends TestCase {
|
||||
public function compliantVersionProvider() {
|
||||
@@ -35,7 +35,7 @@ class ExactVersionConstraintTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider compliantVersionProvider
|
||||
*
|
||||
* @param string $constraintValue
|
||||
* @param string $constraintValue
|
||||
* @param Version $version
|
||||
*/
|
||||
public function testReturnsTrueForCompliantVersion($constraintValue, Version $version) {
|
||||
@@ -47,7 +47,7 @@ class ExactVersionConstraintTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider nonCompliantVersionProvider
|
||||
*
|
||||
* @param string $constraintValue
|
||||
* @param string $constraintValue
|
||||
* @param Version $version
|
||||
*/
|
||||
public function testReturnsFalseForNonCompliantVersion($constraintValue, Version $version) {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\GreaterThanOrEqualToVersionConstraint
|
||||
* @covers \PharIo\Version\GreaterThanOrEqualToVersionConstraint
|
||||
*/
|
||||
class GreaterThanOrEqualToVersionConstraintTest extends TestCase {
|
||||
public function versionProvider() {
|
||||
@@ -37,7 +37,7 @@ class GreaterThanOrEqualToVersionConstraintTest extends TestCase {
|
||||
*
|
||||
* @param Version $constraintVersion
|
||||
* @param Version $version
|
||||
* @param bool $expectedResult
|
||||
* @param bool $expectedResult
|
||||
*/
|
||||
public function testReturnsTrueForCompliantVersions(Version $constraintVersion, Version $version, $expectedResult) {
|
||||
$constraint = new GreaterThanOrEqualToVersionConstraint('foo', $constraintVersion);
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\OrVersionConstraintGroup
|
||||
* @covers \PharIo\Version\OrVersionConstraintGroup
|
||||
*/
|
||||
class OrVersionConstraintGroupTest extends TestCase {
|
||||
public function testReturnsTrueIfOneConstraintReturnsFalse() {
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$secondConstraint = $this->createMock(VersionConstraint::class);
|
||||
|
||||
$firstConstraint->expects($this->once())
|
||||
@@ -34,7 +34,7 @@ class OrVersionConstraintGroupTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testReturnsTrueIfAllConstraintsReturnsTrue() {
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$secondConstraint = $this->createMock(VersionConstraint::class);
|
||||
|
||||
$firstConstraint->expects($this->once())
|
||||
@@ -47,7 +47,7 @@ class OrVersionConstraintGroupTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testReturnsFalseIfAllConstraintsReturnsFalse() {
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$firstConstraint = $this->createMock(VersionConstraint::class);
|
||||
$secondConstraint = $this->createMock(VersionConstraint::class);
|
||||
|
||||
$firstConstraint->expects($this->once())
|
||||
|
||||
46
vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php
vendored
Normal file
46
vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \PharIo\Version\PreReleaseSuffix
|
||||
*/
|
||||
class PreReleaseSuffixTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider greaterThanProvider
|
||||
*
|
||||
* @param string $leftSuffixValue
|
||||
* @param string $rightSuffixValue
|
||||
* @param bool $expectedResult
|
||||
*/
|
||||
public function testGreaterThanReturnsExpectedResult(
|
||||
$leftSuffixValue,
|
||||
$rightSuffixValue,
|
||||
$expectedResult
|
||||
) {
|
||||
$leftSuffix = new PreReleaseSuffix($leftSuffixValue);
|
||||
$rightSuffix = new PreReleaseSuffix($rightSuffixValue);
|
||||
|
||||
$this->assertSame($expectedResult, $leftSuffix->isGreaterThan($rightSuffix));
|
||||
}
|
||||
|
||||
public function greaterThanProvider() {
|
||||
return [
|
||||
['alpha1', 'alpha2', false],
|
||||
['alpha2', 'alpha1', true],
|
||||
['beta1', 'alpha3', true],
|
||||
['b1', 'alpha3', true],
|
||||
['b1', 'a3', true],
|
||||
['dev1', 'alpha2', false],
|
||||
['dev1', 'alpha2', false],
|
||||
['alpha2', 'dev5', true],
|
||||
['rc1', 'beta2', true],
|
||||
['patch5', 'rc7', true],
|
||||
['alpha1', 'alpha.2', false],
|
||||
['alpha.3', 'alpha2', true],
|
||||
['alpha.3', 'alpha.2', true],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\SpecificMajorAndMinorVersionConstraint
|
||||
* @covers \PharIo\Version\SpecificMajorAndMinorVersionConstraint
|
||||
*/
|
||||
class SpecificMajorAndMinorVersionConstraintTest extends TestCase {
|
||||
public function versionProvider() {
|
||||
@@ -32,10 +32,10 @@ class SpecificMajorAndMinorVersionConstraintTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider versionProvider
|
||||
*
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
* @param Version $version
|
||||
* @param bool $expectedResult
|
||||
* @param bool $expectedResult
|
||||
*/
|
||||
public function testReturnsTrueForCompliantVersions($major, $minor, Version $version, $expectedResult) {
|
||||
$constraint = new SpecificMajorAndMinorVersionConstraint('foo', $major, $minor);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PharIo\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers PharIo\Version\SpecificMajorVersionConstraint
|
||||
* @covers \PharIo\Version\SpecificMajorVersionConstraint
|
||||
*/
|
||||
class SpecificMajorVersionConstraintTest extends TestCase {
|
||||
public function versionProvider() {
|
||||
@@ -32,9 +32,9 @@ class SpecificMajorVersionConstraintTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider versionProvider
|
||||
*
|
||||
* @param int $major
|
||||
* @param int $major
|
||||
* @param Version $version
|
||||
* @param bool $expectedResult
|
||||
* @param bool $expectedResult
|
||||
*/
|
||||
public function testReturnsTrueForCompliantVersions($major, Version $version, $expectedResult) {
|
||||
$constraint = new SpecificMajorVersionConstraint('foo', $major);
|
||||
|
||||
@@ -24,9 +24,16 @@ class VersionTest extends TestCase {
|
||||
* @param string $expectedMinor
|
||||
* @param string $expectedPatch
|
||||
* @param string $expectedPreReleaseValue
|
||||
* @param int $expectedReleaseCount
|
||||
* @param int $expectedReleaseCount
|
||||
*/
|
||||
public function testParsesVersionNumbers($versionString, $expectedMajor, $expectedMinor, $expectedPatch, $expectedPreReleaseValue = '', $expectedReleaseCount = 0) {
|
||||
public function testParsesVersionNumbers(
|
||||
$versionString,
|
||||
$expectedMajor,
|
||||
$expectedMinor,
|
||||
$expectedPatch,
|
||||
$expectedPreReleaseValue = '',
|
||||
$expectedReleaseCount = 0
|
||||
) {
|
||||
$version = new Version($versionString);
|
||||
|
||||
$this->assertSame($expectedMajor, $version->getMajor()->getValue());
|
||||
@@ -56,7 +63,7 @@ class VersionTest extends TestCase {
|
||||
*
|
||||
* @param Version $versionA
|
||||
* @param Version $versionB
|
||||
* @param bool $expectedResult
|
||||
* @param bool $expectedResult
|
||||
*/
|
||||
public function testIsGreaterThan(Version $versionA, Version $versionB, $expectedResult) {
|
||||
$this->assertSame($expectedResult, $versionA->isGreaterThan($versionB));
|
||||
@@ -75,6 +82,10 @@ class VersionTest extends TestCase {
|
||||
[new Version('2.5.8'), new Version('1.6.8'), true],
|
||||
[new Version('2.5.8'), new Version('2.6.8'), false],
|
||||
[new Version('2.5.8'), new Version('3.1.2'), false],
|
||||
[new Version('3.0.0-alpha1'), new Version('3.0.0-alpha2'), false],
|
||||
[new Version('3.0.0-alpha2'), new Version('3.0.0-alpha1'), true],
|
||||
[new Version('3.0.0-alpha.1'), new Version('3.0.0'), false],
|
||||
[new Version('3.0.0'), new Version('3.0.0-alpha.1'), true],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -83,8 +94,7 @@ class VersionTest extends TestCase {
|
||||
*
|
||||
* @param string $versionString
|
||||
*/
|
||||
public function testThrowsExceptionIfVersionStringDoesNotFollowSemVer($versionString)
|
||||
{
|
||||
public function testThrowsExceptionIfVersionStringDoesNotFollowSemVer($versionString) {
|
||||
$this->expectException(InvalidVersionException::class);
|
||||
new Version($versionString);
|
||||
}
|
||||
@@ -92,8 +102,7 @@ class VersionTest extends TestCase {
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function invalidVersionStringProvider()
|
||||
{
|
||||
public function invalidVersionStringProvider() {
|
||||
return [
|
||||
['foo'],
|
||||
['0.0.1-dev+ABC', '0', '0', '1', 'dev', 'ABC'],
|
||||
|
||||
Reference in New Issue
Block a user