feat: pr and issue

This commit is contained in:
Nuno Maduro
2024-07-04 00:53:58 +01:00
parent 09ca7a1fd5
commit ee32f25485
26 changed files with 423 additions and 53 deletions

View File

@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace Pest\Configuration;
use NunoMaduro\Collision\Adapters\Phpunit\Printers\DefaultPrinter;
/**
* @internal
*/
final readonly class Context
{
/**
* Sets the test context to GitHub.
*/
public function github(string $project): self
{
DefaultPrinter::linkIssuesWith("https://github.com/{$project}/issues/%s");
DefaultPrinter::linkPrsWith("https://github.com/{$project}/pull/%s");
return $this;
}
/**
* Sets the test context to GitLab.
*/
public function gitlab(string $project): self
{
DefaultPrinter::linkIssuesWith("https://gitlab.com/{$project}/issues/%s");
DefaultPrinter::linkPrsWith("https://gitlab.com/{$project}/merge_requests/%s");
return $this;
}
/**
* Sets the test context to Bitbucket.
*/
public function bitbucket(string $project): self
{
DefaultPrinter::linkIssuesWith('https://bitbucket.org/{$project}/issues/%s');
DefaultPrinter::linkPrsWith("https://bitbucket.org/{$project}/pull-requests/%s");
return $this;
}
/**
* Sets the test context to Jira.
*/
public function jira(string $namespace, string $project): self
{
DefaultPrinter::linkIssuesWith("https://{$namespace}.atlassian.net/browse/{$project}-%s");
return $this;
}
/**
* Sets the test context to custom.
*/
public function using(string $issues, string $prs): self
{
DefaultPrinter::linkIssuesWith($issues);
DefaultPrinter::linkPrsWith($prs);
return $this;
}
}