1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Fix gitlab driver issues not asking for auth when token is missing, and not falling back properly to git driver

This commit is contained in:
Jordi Boggiano 2017-03-08 10:26:08 +01:00
parent daff57189f
commit f200343cf2
3 changed files with 91 additions and 5 deletions

View file

@ -293,8 +293,31 @@ JSON;
$url = 'https://mycompany.com/gitlab/mygroup/my-pro.ject';
$apiUrl = 'https://mycompany.com/gitlab/api/v3/projects/mygroup%2Fmy-pro%2Eject';
$projectData = <<<JSON
{
"id": 17,
"default_branch": "mymaster",
"public": false,
"http_url_to_repo": "https://gitlab.com/mygroup/my-pro.ject",
"ssh_url_to_repo": "git@gitlab.com:mygroup/my-pro.ject.git",
"last_activity_at": "2014-12-01T09:17:51.000+01:00",
"name": "My Project",
"name_with_namespace": "My Group / My Project",
"path": "myproject",
"path_with_namespace": "mygroup/my-pro.ject",
"web_url": "https://gitlab.com/mygroup/my-pro.ject"
}
JSON;
$this->remoteFilesystem
->getContents('mycompany.com/gitlab', $apiUrl, false)
->willReturn($projectData)
->shouldBeCalledTimes(1)
;
$driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
$driver->initialize();
$this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
}
}