mirror of
https://github.com/pestphp/pest.git
synced 2026-06-11 21:48:26 +02:00
fix: update gitlab urls for issues and prs to match new format (#1728)
* fix: update gitlab urls for issues and prs to match new format Added an optional host parameter to the gitlab method, defaulting to 'gitlab.com'. Updated the issues and prs URLs to include '/-/' in the path, which is the new format for GitLab URLs. This change ensures that the URLs generated for GitLab projects are correct and reflect the new structure of GitLab's URLs for issues and merge requests. Host parameter allows users to specify a custom GitLab instance if they are using a self-hosted version of GitLab, while still maintaining the default behavior for users who are using gitlab.com. * fix: update gitlab method to use hostname parameter correctly
This commit is contained in:
@ -59,12 +59,15 @@ final class Project
|
|||||||
/**
|
/**
|
||||||
* Sets the test project to GitLab.
|
* Sets the test project to GitLab.
|
||||||
*/
|
*/
|
||||||
public function gitlab(string $project): self
|
public function gitlab(string $project, string $hostname = 'gitlab.com'): self
|
||||||
{
|
{
|
||||||
$this->issues = "https://gitlab.com/{$project}/issues/%s";
|
// Simple way to ensure only the host is used
|
||||||
$this->prs = "https://gitlab.com/{$project}/merge_requests/%s";
|
$hostname = parse_url($hostname, PHP_URL_HOST) ?? $hostname;
|
||||||
|
|
||||||
$this->assignees = 'https://gitlab.com/%s';
|
$this->issues = "https://{$hostname}/{$project}/-/work_items/%s";
|
||||||
|
$this->prs = "https://{$hostname}/{$project}/-/merge_requests/%s";
|
||||||
|
|
||||||
|
$this->assignees = "https://{$hostname}/%s";
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user