GitLabDriverTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Repository\Vcs;
  12. use Composer\Repository\Vcs\GitLabDriver;
  13. use Composer\Config;
  14. use Composer\TestCase;
  15. use Composer\Util\Filesystem;
  16. use Prophecy\Argument;
  17. /**
  18. * @author Jérôme Tamarelle <jerome@tamarelle.net>
  19. */
  20. class GitLabDriverTest extends TestCase
  21. {
  22. private $home;
  23. private $config;
  24. private $io;
  25. private $process;
  26. private $remoteFilesystem;
  27. public function setUp()
  28. {
  29. $this->home = $this->getUniqueTmpDirectory();
  30. $this->config = new Config();
  31. $this->config->merge(array(
  32. 'config' => array(
  33. 'home' => $this->home,
  34. 'gitlab-domains' => array(
  35. 'mycompany.com/gitlab',
  36. 'othercompany.com/nested/gitlab',
  37. 'gitlab.com',
  38. ),
  39. ),
  40. ));
  41. $this->io = $this->prophesize('Composer\IO\IOInterface');
  42. $this->process = $this->prophesize('Composer\Util\ProcessExecutor');
  43. $this->remoteFilesystem = $this->prophesize('Composer\Util\RemoteFilesystem');
  44. }
  45. public function tearDown()
  46. {
  47. $fs = new Filesystem();
  48. $fs->removeDirectory($this->home);
  49. }
  50. public function getInitializeUrls()
  51. {
  52. return array(
  53. array('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'),
  54. array('http://gitlab.com/mygroup/myproject', 'http://gitlab.com/api/v4/projects/mygroup%2Fmyproject'),
  55. array('git@gitlab.com:mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'),
  56. );
  57. }
  58. /**
  59. * @dataProvider getInitializeUrls
  60. */
  61. public function testInitialize($url, $apiUrl)
  62. {
  63. // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
  64. $projectData = <<<JSON
  65. {
  66. "id": 17,
  67. "default_branch": "mymaster",
  68. "visibility": "private",
  69. "http_url_to_repo": "https://gitlab.com/mygroup/myproject.git",
  70. "ssh_url_to_repo": "git@gitlab.com:mygroup/myproject.git",
  71. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  72. "name": "My Project",
  73. "name_with_namespace": "My Group / My Project",
  74. "path": "myproject",
  75. "path_with_namespace": "mygroup/myproject",
  76. "web_url": "https://gitlab.com/mygroup/myproject"
  77. }
  78. JSON;
  79. $this->remoteFilesystem
  80. ->getContents('gitlab.com', $apiUrl, false, array())
  81. ->willReturn($projectData)
  82. ->shouldBeCalledTimes(1)
  83. ;
  84. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  85. $driver->initialize();
  86. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  87. $this->assertEquals('mymaster', $driver->getRootIdentifier(), 'Root identifier is the default branch in GitLab');
  88. $this->assertEquals('git@gitlab.com:mygroup/myproject.git', $driver->getRepositoryUrl(), 'The repository URL is the SSH one by default');
  89. $this->assertEquals('https://gitlab.com/mygroup/myproject', $driver->getUrl());
  90. return $driver;
  91. }
  92. /**
  93. * @dataProvider getInitializeUrls
  94. */
  95. public function testInitializePublicProject($url, $apiUrl)
  96. {
  97. // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
  98. $projectData = <<<JSON
  99. {
  100. "id": 17,
  101. "default_branch": "mymaster",
  102. "visibility": "public",
  103. "http_url_to_repo": "https://gitlab.com/mygroup/myproject.git",
  104. "ssh_url_to_repo": "git@gitlab.com:mygroup/myproject.git",
  105. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  106. "name": "My Project",
  107. "name_with_namespace": "My Group / My Project",
  108. "path": "myproject",
  109. "path_with_namespace": "mygroup/myproject",
  110. "web_url": "https://gitlab.com/mygroup/myproject"
  111. }
  112. JSON;
  113. $this->remoteFilesystem
  114. ->getContents('gitlab.com', $apiUrl, false, array())
  115. ->willReturn($projectData)
  116. ->shouldBeCalledTimes(1)
  117. ;
  118. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  119. $driver->initialize();
  120. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  121. $this->assertEquals('mymaster', $driver->getRootIdentifier(), 'Root identifier is the default branch in GitLab');
  122. $this->assertEquals('https://gitlab.com/mygroup/myproject.git', $driver->getRepositoryUrl(), 'The repository URL is the SSH one by default');
  123. $this->assertEquals('https://gitlab.com/mygroup/myproject', $driver->getUrl());
  124. return $driver;
  125. }
  126. /**
  127. * @dataProvider getInitializeUrls
  128. */
  129. public function testInitializePublicProjectAsAnonymous($url, $apiUrl)
  130. {
  131. // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
  132. $projectData = <<<JSON
  133. {
  134. "id": 17,
  135. "default_branch": "mymaster",
  136. "http_url_to_repo": "https://gitlab.com/mygroup/myproject.git",
  137. "ssh_url_to_repo": "git@gitlab.com:mygroup/myproject.git",
  138. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  139. "name": "My Project",
  140. "name_with_namespace": "My Group / My Project",
  141. "path": "myproject",
  142. "path_with_namespace": "mygroup/myproject",
  143. "web_url": "https://gitlab.com/mygroup/myproject"
  144. }
  145. JSON;
  146. $this->remoteFilesystem
  147. ->getContents('gitlab.com', $apiUrl, false, array())
  148. ->willReturn($projectData)
  149. ->shouldBeCalledTimes(1)
  150. ;
  151. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  152. $driver->initialize();
  153. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  154. $this->assertEquals('mymaster', $driver->getRootIdentifier(), 'Root identifier is the default branch in GitLab');
  155. $this->assertEquals('https://gitlab.com/mygroup/myproject.git', $driver->getRepositoryUrl(), 'The repository URL is the SSH one by default');
  156. $this->assertEquals('https://gitlab.com/mygroup/myproject', $driver->getUrl());
  157. return $driver;
  158. }
  159. public function testGetDist()
  160. {
  161. $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
  162. $reference = 'c3ebdbf9cceddb82cd2089aaef8c7b992e536363';
  163. $expected = array(
  164. 'type' => 'zip',
  165. 'url' => 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/archive.zip?sha='.$reference,
  166. 'reference' => $reference,
  167. 'shasum' => '',
  168. );
  169. $this->assertEquals($expected, $driver->getDist($reference));
  170. }
  171. public function testGetSource()
  172. {
  173. $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
  174. $reference = 'c3ebdbf9cceddb82cd2089aaef8c7b992e536363';
  175. $expected = array(
  176. 'type' => 'git',
  177. 'url' => 'git@gitlab.com:mygroup/myproject.git',
  178. 'reference' => $reference,
  179. );
  180. $this->assertEquals($expected, $driver->getSource($reference));
  181. }
  182. public function testGetSource_GivenPublicProject()
  183. {
  184. $driver = $this->testInitializePublicProject('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject', true);
  185. $reference = 'c3ebdbf9cceddb82cd2089aaef8c7b992e536363';
  186. $expected = array(
  187. 'type' => 'git',
  188. 'url' => 'https://gitlab.com/mygroup/myproject.git',
  189. 'reference' => $reference,
  190. );
  191. $this->assertEquals($expected, $driver->getSource($reference));
  192. }
  193. public function testGetTags()
  194. {
  195. $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
  196. $apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?per_page=100';
  197. // @link http://doc.gitlab.com/ce/api/repositories.html#list-project-repository-tags
  198. $tagData = <<<JSON
  199. [
  200. {
  201. "name": "v1.0.0",
  202. "commit": {
  203. "id": "092ed2c762bbae331e3f51d4a17f67310bf99a81",
  204. "committed_date": "2012-05-28T04:42:42-07:00"
  205. }
  206. },
  207. {
  208. "name": "v2.0.0",
  209. "commit": {
  210. "id": "8e8f60b3ec86d63733db3bd6371117a758027ec6",
  211. "committed_date": "2014-07-06T12:59:11.000+02:00"
  212. }
  213. }
  214. ]
  215. JSON;
  216. $this->remoteFilesystem
  217. ->getContents('gitlab.com', $apiUrl, false, array())
  218. ->willReturn($tagData)
  219. ->shouldBeCalledTimes(1)
  220. ;
  221. $this->remoteFilesystem->getLastHeaders()
  222. ->willReturn(array());
  223. $driver->setRemoteFilesystem($this->remoteFilesystem->reveal());
  224. $expected = array(
  225. 'v1.0.0' => '092ed2c762bbae331e3f51d4a17f67310bf99a81',
  226. 'v2.0.0' => '8e8f60b3ec86d63733db3bd6371117a758027ec6',
  227. );
  228. $this->assertEquals($expected, $driver->getTags());
  229. $this->assertEquals($expected, $driver->getTags(), 'Tags are cached');
  230. }
  231. public function testGetPaginatedRefs() {
  232. $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
  233. $apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/branches?per_page=100';
  234. // @link http://doc.gitlab.com/ce/api/repositories.html#list-project-repository-branches
  235. $branchData = array(
  236. array(
  237. "name" => "mymaster",
  238. "commit" => array(
  239. "id" => "97eda36b5c1dd953a3792865c222d4e85e5f302e",
  240. "committed_date" => "2013-01-03T21:04:07.000+01:00"
  241. )
  242. ),
  243. array(
  244. "name" => "staging",
  245. "commit" => array(
  246. "id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
  247. "committed_date" => "2013-03-09T16:35:23.000+01:00"
  248. )
  249. ),
  250. );
  251. for ($i = 0; $i < 98; $i++) {
  252. $branchData[] = array(
  253. "name" => "stagingdupe",
  254. "commit" => array(
  255. "id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
  256. "committed_date" => "2013-03-09T16:35:23.000+01:00"
  257. )
  258. );
  259. }
  260. $branchData = json_encode($branchData);
  261. $this->remoteFilesystem
  262. ->getContents('gitlab.com', $apiUrl, false, array())
  263. ->willReturn($branchData)
  264. ->shouldBeCalledTimes(1)
  265. ;
  266. $this->remoteFilesystem
  267. ->getContents('gitlab.com', "http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=2&per_page=20", false, array())
  268. ->willReturn($branchData)
  269. ->shouldBeCalledTimes(1)
  270. ;
  271. $this->remoteFilesystem->getLastHeaders()
  272. ->willReturn(
  273. array('Link: <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=2&per_page=20>; rel="next", <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=1&per_page=20>; rel="first", <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=3&per_page=20>; rel="last"'),
  274. array('Link: <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=2&per_page=20>; rel="prev", <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=1&per_page=20>; rel="first", <http://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/tags?id=mygroup%2Fmyproject&page=3&per_page=20>; rel="last"')
  275. )
  276. ->shouldBeCalledTimes(2);
  277. $driver->setRemoteFilesystem($this->remoteFilesystem->reveal());
  278. $expected = array(
  279. 'mymaster' => '97eda36b5c1dd953a3792865c222d4e85e5f302e',
  280. 'staging' => '502cffe49f136443f2059803f2e7192d1ac066cd',
  281. 'stagingdupe' => '502cffe49f136443f2059803f2e7192d1ac066cd',
  282. );
  283. $this->assertEquals($expected, $driver->getBranches());
  284. $this->assertEquals($expected, $driver->getBranches(), 'Branches are cached');
  285. }
  286. public function testGetBranches()
  287. {
  288. $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
  289. $apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/branches?per_page=100';
  290. // @link http://doc.gitlab.com/ce/api/repositories.html#list-project-repository-branches
  291. $branchData = <<<JSON
  292. [
  293. {
  294. "name": "mymaster",
  295. "commit": {
  296. "id": "97eda36b5c1dd953a3792865c222d4e85e5f302e",
  297. "committed_date": "2013-01-03T21:04:07.000+01:00"
  298. }
  299. },
  300. {
  301. "name": "staging",
  302. "commit": {
  303. "id": "502cffe49f136443f2059803f2e7192d1ac066cd",
  304. "committed_date": "2013-03-09T16:35:23.000+01:00"
  305. }
  306. }
  307. ]
  308. JSON;
  309. $this->remoteFilesystem
  310. ->getContents('gitlab.com', $apiUrl, false, array())
  311. ->willReturn($branchData)
  312. ->shouldBeCalledTimes(1)
  313. ;
  314. $this->remoteFilesystem->getLastHeaders()
  315. ->willReturn(array());
  316. $driver->setRemoteFilesystem($this->remoteFilesystem->reveal());
  317. $expected = array(
  318. 'mymaster' => '97eda36b5c1dd953a3792865c222d4e85e5f302e',
  319. 'staging' => '502cffe49f136443f2059803f2e7192d1ac066cd',
  320. );
  321. $this->assertEquals($expected, $driver->getBranches());
  322. $this->assertEquals($expected, $driver->getBranches(), 'Branches are cached');
  323. }
  324. /**
  325. * @dataProvider dataForTestSupports
  326. */
  327. public function testSupports($url, $expected)
  328. {
  329. $this->assertSame($expected, GitLabDriver::supports($this->io->reveal(), $this->config, $url));
  330. }
  331. public function dataForTestSupports()
  332. {
  333. return array(
  334. array('http://gitlab.com/foo/bar', true),
  335. array('http://gitlab.com/foo/bar/', true),
  336. array('http://gitlab.com/foo/bar.git', true),
  337. array('http://gitlab.com/foo/bar.baz.git', true),
  338. array('https://gitlab.com/foo/bar', extension_loaded('openssl')), // Platform requirement
  339. array('git@gitlab.com:foo/bar.git', extension_loaded('openssl')),
  340. array('git@example.com:foo/bar.git', false),
  341. array('http://example.com/foo/bar', false),
  342. array('http://mycompany.com/gitlab/mygroup/myproject', true),
  343. array('https://mycompany.com/gitlab/mygroup/myproject', extension_loaded('openssl')),
  344. array('http://othercompany.com/nested/gitlab/mygroup/myproject', true),
  345. array('https://othercompany.com/nested/gitlab/mygroup/myproject', extension_loaded('openssl')),
  346. array('http://gitlab.com/mygroup/mysubgroup/mysubsubgroup/myproject', true),
  347. array('https://gitlab.com/mygroup/mysubgroup/mysubsubgroup/myproject', extension_loaded('openssl')),
  348. );
  349. }
  350. public function testGitlabSubDirectory()
  351. {
  352. $url = 'https://mycompany.com/gitlab/mygroup/my-pro.ject';
  353. $apiUrl = 'https://mycompany.com/gitlab/api/v4/projects/mygroup%2Fmy-pro%2Eject';
  354. $projectData = <<<JSON
  355. {
  356. "id": 17,
  357. "default_branch": "mymaster",
  358. "visibility": "private",
  359. "http_url_to_repo": "https://gitlab.com/gitlab/mygroup/my-pro.ject",
  360. "ssh_url_to_repo": "git@gitlab.com:mygroup/my-pro.ject.git",
  361. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  362. "name": "My Project",
  363. "name_with_namespace": "My Group / My Project",
  364. "path": "myproject",
  365. "path_with_namespace": "mygroup/my-pro.ject",
  366. "web_url": "https://gitlab.com/gitlab/mygroup/my-pro.ject"
  367. }
  368. JSON;
  369. $this->remoteFilesystem
  370. ->getContents('mycompany.com/gitlab', $apiUrl, false, array())
  371. ->willReturn($projectData)
  372. ->shouldBeCalledTimes(1)
  373. ;
  374. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  375. $driver->initialize();
  376. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  377. }
  378. public function testGitlabSubGroup()
  379. {
  380. $url = 'https://gitlab.com/mygroup/mysubgroup/myproject';
  381. $apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmysubgroup%2Fmyproject';
  382. $projectData = <<<JSON
  383. {
  384. "id": 17,
  385. "default_branch": "mymaster",
  386. "visibility": "private",
  387. "http_url_to_repo": "https://gitlab.com/mygroup/mysubgroup/my-pro.ject",
  388. "ssh_url_to_repo": "git@gitlab.com:mygroup/mysubgroup/my-pro.ject.git",
  389. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  390. "name": "My Project",
  391. "name_with_namespace": "My Group / My Project",
  392. "path": "myproject",
  393. "path_with_namespace": "mygroup/mysubgroup/my-pro.ject",
  394. "web_url": "https://gitlab.com/mygroup/mysubgroup/my-pro.ject"
  395. }
  396. JSON;
  397. $this->remoteFilesystem
  398. ->getContents('gitlab.com', $apiUrl, false, array())
  399. ->willReturn($projectData)
  400. ->shouldBeCalledTimes(1)
  401. ;
  402. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  403. $driver->initialize();
  404. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  405. }
  406. public function testGitlabSubDirectorySubGroup()
  407. {
  408. $url = 'https://mycompany.com/gitlab/mygroup/mysubgroup/myproject';
  409. $apiUrl = 'https://mycompany.com/gitlab/api/v4/projects/mygroup%2Fmysubgroup%2Fmyproject';
  410. $projectData = <<<JSON
  411. {
  412. "id": 17,
  413. "default_branch": "mymaster",
  414. "visibility": "private",
  415. "http_url_to_repo": "https://mycompany.com/gitlab/mygroup/mysubgroup/my-pro.ject",
  416. "ssh_url_to_repo": "git@mycompany.com:mygroup/mysubgroup/my-pro.ject.git",
  417. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  418. "name": "My Project",
  419. "name_with_namespace": "My Group / My Project",
  420. "path": "myproject",
  421. "path_with_namespace": "mygroup/mysubgroup/my-pro.ject",
  422. "web_url": "https://mycompany.com/gitlab/mygroup/mysubgroup/my-pro.ject"
  423. }
  424. JSON;
  425. $this->remoteFilesystem
  426. ->getContents('mycompany.com/gitlab', $apiUrl, false, array())
  427. ->willReturn($projectData)
  428. ->shouldBeCalledTimes(1)
  429. ;
  430. $driver = new GitLabDriver(array('url' => $url), $this->io->reveal(), $this->config, $this->process->reveal(), $this->remoteFilesystem->reveal());
  431. $driver->initialize();
  432. $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL');
  433. }
  434. public function testForwardsOptions()
  435. {
  436. $options = array(
  437. 'ssl' => array(
  438. 'verify_peer' => false,
  439. ),
  440. );
  441. $projectData = <<<JSON
  442. {
  443. "id": 17,
  444. "default_branch": "mymaster",
  445. "visibility": "private",
  446. "http_url_to_repo": "https://gitlab.mycompany.local/mygroup/myproject",
  447. "ssh_url_to_repo": "git@gitlab.mycompany.local:mygroup/myproject.git",
  448. "last_activity_at": "2014-12-01T09:17:51.000+01:00",
  449. "name": "My Project",
  450. "name_with_namespace": "My Group / My Project",
  451. "path": "myproject",
  452. "path_with_namespace": "mygroup/myproject",
  453. "web_url": "https://gitlab.mycompany.local/mygroup/myproject"
  454. }
  455. JSON;
  456. $this->remoteFilesystem
  457. ->getContents(Argument::cetera(), $options)
  458. ->willReturn($projectData)
  459. ->shouldBeCalled();
  460. $driver = new GitLabDriver(
  461. array('url' => 'https://gitlab.mycompany.local/mygroup/myproject', 'options' => $options),
  462. $this->io->reveal(),
  463. $this->config,
  464. $this->process->reveal(),
  465. $this->remoteFilesystem->reveal()
  466. );
  467. $driver->initialize();
  468. }
  469. }