Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PHPCI/Service/ProjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ protected function processAccessInformation(Project &$project)
if ($project->getType() == 'gitlab') {
$info = array();

if (preg_match('`^(.+)@(.+):([0-9]*)\/?(.+)\.git`', $reference, $matches)) {
if (preg_match('`^(.+)@(.+):(([0-9]*)\/)?\/?(.+)\.git`', $reference, $matches)) {
$info['user'] = $matches[1];
$info['domain'] = $matches[2];
$info['port'] = $matches[3];
$info['port'] = $matches[4];

$project->setReference($matches[4]);
$project->setReference($matches[5]);
}

$project->setAccessInformation($info);
Expand Down
22 changes: 22 additions & 0 deletions Tests/PHPCI/Service/ProjectServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,26 @@ public function testExecute_DeleteProject()

$this->assertEquals(true, $service->deleteProject($project));
}


public function testExecute_CreateGitlabProjectWithNumberInVendor()
{
$reference = '[email protected]:8block/phpci.git';
$returnValue = $this->testedService->createProject('Gitlab', 'gitlab', $reference);

$this->assertEquals('git', $returnValue->getAccessInformation('user'));
$this->assertEquals('gitlab.block8.net', $returnValue->getAccessInformation('domain'));
$this->assertEquals('8block/phpci', $returnValue->getReference());
}

public function testExecute_CreateGitlabProjectWithPortAndNumberInVendor()
{
$reference = '[email protected]:22/8block/phpci.git';
$returnValue = $this->testedService->createProject('Gitlab', 'gitlab', $reference);

$this->assertEquals('git', $returnValue->getAccessInformation('user'));
$this->assertEquals('gitlab.block8.net', $returnValue->getAccessInformation('domain'));
$this->assertEquals(22, $returnValue->getAccessInformation('port'));
$this->assertEquals('8block/phpci', $returnValue->getReference());
}
}