/** * Get the suggested new versions based off the current version and the given change list. * * The order of the suggestions is driven off of the "largest" change in the change list. * * @param \Guywithnose\ReleaseNotes\Version $currentVersion The current version. * @param \Guywithnose\ReleaseNotes\Change\ChangeList $changes The changes. * @return array The semantic versions that work for a new version. */ private function _getSuggestedNewVersions(Version $currentVersion, ChangeList $changes) { $increments = $currentVersion->getSemanticIncrements(); if (empty($increments)) { return []; } $largestChange = $changes->largestChange(); $largestChangeType = $largestChange ? $largestChange->getType() : Change::TYPE_MINOR; if ($largestChangeType === Change::TYPE_BC) { return [$increments['major'], $increments['minor'], $increments['patch']]; } if ($largestChangeType === Change::TYPE_MAJOR) { return [$increments['minor'], $increments['patch'], $increments['major']]; } return [$increments['patch'], $increments['minor'], $increments['major']]; }
/** * @param mixed $versionString The version * @param bool $expectedVersionString The expected version string * @dataProvider provideConstructorVersion() */ public function testUnprocessed($versionString, $expectedVersionString) { $version = new Version($versionString); $this->assertSame($expectedVersionString, $version->unprocessed()); }