-
+
{{ release.project.title }}
|
+
+ {{ release.branch.name }}
+ |
{{ release.currentTag.toString }}
|
diff --git a/templates/releases/project.html.twig b/templates/releases/project.html.twig
index 54ddb2f7d..d01873541 100644
--- a/templates/releases/project.html.twig
+++ b/templates/releases/project.html.twig
@@ -3,7 +3,7 @@
{% extends 'nav_and_content.html.twig' %}
{% block content_title %}
- Next Release for {{ release.project.title }}
+ Next Release for {{ release.project.title }} {{ release.branch.name }}
{% endblock %}
{% block content %}
diff --git a/tests/Action/DetermineNextReleaseVersionTest.php b/tests/Action/DetermineNextReleaseVersionTest.php
index 249c1aa02..865135007 100644
--- a/tests/Action/DetermineNextReleaseVersionTest.php
+++ b/tests/Action/DetermineNextReleaseVersionTest.php
@@ -41,7 +41,7 @@ public function returnsCurrentIfNoPullRequestsAreProvider()
/**
* @test
*/
- public function returnsCurrentIfNoMinorOrPatchStabilityIsFound()
+ public function returnsCurrentIfNoMajorOrMinorOrPatchStabilityIsFound()
{
$tag = Tag::fromString('1.1.0');
@@ -77,6 +77,50 @@ public function determine(string $expected, string $current, array $pullRequests
*/
public function determineProvider(): \Generator
{
+ yield [
+ '2.0.0',
+ '1.1.0',
+ [
+ self::createPullRequestWithStability(Stability::unknown()),
+ self::createPullRequestWithStability(Stability::major()),
+ self::createPullRequestWithStability(Stability::minor()),
+ self::createPullRequestWithStability(Stability::patch()),
+ ],
+ ];
+
+ yield [
+ '2.0.0',
+ '2.0.0-alpha-1',
+ [
+ self::createPullRequestWithStability(Stability::unknown()),
+ self::createPullRequestWithStability(Stability::major()),
+ self::createPullRequestWithStability(Stability::minor()),
+ self::createPullRequestWithStability(Stability::patch()),
+ ],
+ ];
+
+ yield [
+ '2.0.0',
+ '2.0.0.alpha.1',
+ [
+ self::createPullRequestWithStability(Stability::unknown()),
+ self::createPullRequestWithStability(Stability::major()),
+ self::createPullRequestWithStability(Stability::minor()),
+ self::createPullRequestWithStability(Stability::patch()),
+ ],
+ ];
+
+ yield [
+ '2.0.0',
+ '1.1.0',
+ [
+ self::createPullRequestWithStability(Stability::unknown()),
+ self::createPullRequestWithStability(Stability::major()),
+ self::createPullRequestWithStability(Stability::minor()),
+ self::createPullRequestWithStability(Stability::patch()),
+ ],
+ ];
+
yield [
'1.2.0',
'1.1.0',
diff --git a/tests/Action/Exception/CannotDeterminNextReleaseTest.php b/tests/Action/Exception/CannotDeterminNextReleaseTest.php
index 8a746de98..c88007565 100644
--- a/tests/Action/Exception/CannotDeterminNextReleaseTest.php
+++ b/tests/Action/Exception/CannotDeterminNextReleaseTest.php
@@ -43,8 +43,9 @@ public function forProject()
$config[ProjectTest::DEFAULT_CONFIG_NAME],
$package
);
+ $branch = $project->unstableBranch();
- $cannotDetermineNextRelease = CannotDetermineNextRelease::forProject($project);
+ $cannotDetermineNextRelease = CannotDetermineNextRelease::forBranch($project, $branch);
self::assertInstanceOf(
\RuntimeException::class,
@@ -52,7 +53,8 @@ public function forProject()
);
self::assertSame(
sprintf(
- 'Cannot determine next release for Project "%s".',
+ 'Cannot determine next release for branch "%s" of project "%s".',
+ $branch->name(),
$project->name()
),
$cannotDetermineNextRelease->getMessage()
diff --git a/tests/Action/Exception/NoPullRequestMergedSinceLastReleaseTest.php b/tests/Action/Exception/NoPullRequestMergedSinceLastReleaseTest.php
index 843bf0512..201f6db5e 100644
--- a/tests/Action/Exception/NoPullRequestMergedSinceLastReleaseTest.php
+++ b/tests/Action/Exception/NoPullRequestMergedSinceLastReleaseTest.php
@@ -43,11 +43,13 @@ public function forProject()
$config[ProjectTest::DEFAULT_CONFIG_NAME],
$package
);
+ $branch = $project->unstableBranch();
$lastRelease = new \DateTimeImmutable($datetime = '2020-01-01 10:00:01');
- $cannotDetermineNextRelease = NoPullRequestsMergedSinceLastRelease::forProject(
+ $cannotDetermineNextRelease = NoPullRequestsMergedSinceLastRelease::forBranch(
$project,
+ $branch,
$lastRelease
);
@@ -57,8 +59,9 @@ public function forProject()
);
self::assertSame(
sprintf(
- 'No pull requests merged since last release "%s" for Project "%s".',
+ 'No pull requests merged since last release "%s" for branch "%s" of project "%s".',
$datetime,
+ $branch->name(),
$project->name()
),
$cannotDetermineNextRelease->getMessage()
diff --git a/tests/Config/Exception/UnknownBranchTest.php b/tests/Config/Exception/UnknownBranchTest.php
new file mode 100644
index 000000000..676bc23b5
--- /dev/null
+++ b/tests/Config/Exception/UnknownBranchTest.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace App\Tests\Config\Exception;
+
+use App\Config\Exception\UnknownBranch;
+use App\Domain\Value\Project;
+use App\Tests\Domain\Value\ProjectTest;
+use Ergebnis\Test\Util\Helper;
+use Packagist\Api\Result\Package;
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Yaml\Yaml;
+
+final class UnknownBranchTest extends TestCase
+{
+ use Helper;
+
+ /**
+ * @test
+ */
+ public function forName()
+ {
+ $package = new Package();
+ $package->fromArray([
+ 'name' => $packageName = 'sonata-project/admin-bundle',
+ 'repository' => 'https://github.com/sonata-project/SonataAdminBundle',
+ ]);
+
+ $config = Yaml::parse(ProjectTest::DEFAULT_CONFIG);
+
+ $project = Project::fromValues(
+ ProjectTest::DEFAULT_CONFIG_NAME,
+ $config[ProjectTest::DEFAULT_CONFIG_NAME],
+ $package
+ );
+
+ $name = self::faker()->word;
+
+ $unknownBranch = UnknownBranch::forName($project, $name);
+
+ self::assertInstanceOf(
+ \InvalidArgumentException::class,
+ $unknownBranch
+ );
+ self::assertSame(
+ sprintf(
+ 'Could not find branch with name "%s" for project "%s".',
+ $name,
+ $project->name()
+ ),
+ $unknownBranch->getMessage()
+ );
+ }
+}
diff --git a/tests/Config/Exception/UnknownProjectTest.php b/tests/Config/Exception/UnknownProjectTest.php
index 93094177a..ba2163427 100644
--- a/tests/Config/Exception/UnknownProjectTest.php
+++ b/tests/Config/Exception/UnknownProjectTest.php
@@ -36,7 +36,7 @@ public function forName()
);
self::assertSame(
sprintf(
- 'Could not find Project with name "%s".',
+ 'Could not find project with name "%s".',
$name
),
$unknownProject->getMessage()