mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 09:47:23 +01:00
Adjusts for Collision 8.4
This commit is contained in:
@ -4,20 +4,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace Pest\Configuration;
|
||||
|
||||
use NunoMaduro\Collision\Adapters\Phpunit\Printers\DefaultPrinter;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final readonly class Context
|
||||
final class Context
|
||||
{
|
||||
/**
|
||||
* The issues link.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public string $issues = '';
|
||||
|
||||
/**
|
||||
* The PRs link.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public string $prs = '';
|
||||
|
||||
/**
|
||||
* The singleton instance.
|
||||
*/
|
||||
private static ?self $instance = null;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the context.
|
||||
*/
|
||||
public static function getInstance(): self
|
||||
{
|
||||
return self::$instance ??= new self;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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");
|
||||
$this->issues = "https://github.com/{$project}/issues/%s";
|
||||
$this->prs = "https://github.com/{$project}/pull/%s";
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -27,8 +52,8 @@ final readonly class Context
|
||||
*/
|
||||
public function gitlab(string $project): self
|
||||
{
|
||||
DefaultPrinter::linkIssuesWith("https://gitlab.com/{$project}/issues/%s");
|
||||
DefaultPrinter::linkPrsWith("https://gitlab.com/{$project}/merge_requests/%s");
|
||||
$this->issues = "https://gitlab.com/{$project}/issues/%s";
|
||||
$this->prs = "https://gitlab.com/{$project}/merge_requests/%s";
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -38,8 +63,8 @@ final readonly class Context
|
||||
*/
|
||||
public function bitbucket(string $project): self
|
||||
{
|
||||
DefaultPrinter::linkIssuesWith('https://bitbucket.org/{$project}/issues/%s');
|
||||
DefaultPrinter::linkPrsWith("https://bitbucket.org/{$project}/pull-requests/%s");
|
||||
$this->issues = 'https://bitbucket.org/{$project}/issues/%s';
|
||||
$this->prs = "https://bitbucket.org/{$project}/pull-requests/%s";
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -49,7 +74,7 @@ final readonly class Context
|
||||
*/
|
||||
public function jira(string $namespace, string $project): self
|
||||
{
|
||||
DefaultPrinter::linkIssuesWith("https://{$namespace}.atlassian.net/browse/{$project}-%s");
|
||||
$this->issues = "https://{$namespace}.atlassian.net/browse/{$project}-%s";
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -59,8 +84,8 @@ final readonly class Context
|
||||
*/
|
||||
public function using(string $issues, string $prs): self
|
||||
{
|
||||
DefaultPrinter::linkIssuesWith($issues);
|
||||
DefaultPrinter::linkPrsWith($prs);
|
||||
$this->issues = $issues;
|
||||
$this->prs = $prs;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user