Skip to content

Commit 1ca5831

Browse files
Add asset repository manager in git driver from github driver
1 parent ac0c4e3 commit 1ca5831

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Repository/Vcs/GitHubDriver.php

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ protected function setupGitDriver($url)
140140
'url' => $url,
141141
'asset-type' => $this->repoConfig['asset-type'],
142142
'filename' => $this->repoConfig['filename'],
143+
'asset-repository-manager' => $this->repoConfig['asset-repository-manager'],
143144
),
144145
$this->io,
145146
$this->config,

Tests/Repository/Vcs/GitHubDriverTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Composer\Util\Filesystem;
2020
use Composer\Util\ProcessExecutor;
2121
use Composer\Util\RemoteFilesystem;
22+
use Fxp\Composer\AssetPlugin\Repository\AssetRepositoryManager;
2223
use Fxp\Composer\AssetPlugin\Repository\Vcs\GitHubDriver;
2324

2425
/**
@@ -33,6 +34,11 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
3334
*/
3435
private $config;
3536

37+
/**
38+
* @var AssetRepositoryManager|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $assetRepositoryManager;
41+
3642
public function setUp()
3743
{
3844
$this->config = new Config();
@@ -42,6 +48,9 @@ public function setUp()
4248
'cache-repo-dir' => sys_get_temp_dir().'/composer-test-cache',
4349
),
4450
));
51+
52+
$this->assetRepositoryManager = $this->getMockBuilder(AssetRepositoryManager::class)
53+
->disableOriginalConstructor()->getMock();
4554
}
4655

4756
public function tearDown()
@@ -141,6 +150,7 @@ public function testPrivateRepository($type, $filename)
141150
$repoConfig = array(
142151
'url' => $repoUrl,
143152
'asset-type' => $type,
153+
'asset-repository-manager' => $this->assetRepositoryManager,
144154
'filename' => $filename,
145155
'package-name' => $packageName,
146156
);
@@ -193,6 +203,7 @@ public function testPublicRepository($type, $filename)
193203
$repoConfig = array(
194204
'url' => $repoUrl,
195205
'asset-type' => $type,
206+
'asset-repository-manager' => $this->assetRepositoryManager,
196207
'filename' => $filename,
197208
'package-name' => $packageName,
198209
);
@@ -259,6 +270,7 @@ public function testPublicRepository2($type, $filename)
259270
$repoConfig = array(
260271
'url' => $repoUrl,
261272
'asset-type' => $type,
273+
'asset-repository-manager' => $this->assetRepositoryManager,
262274
'filename' => $filename,
263275
'package-name' => $packageName,
264276
);
@@ -374,6 +386,7 @@ public function testPrivateRepositoryNoInteraction($type, $filename)
374386
$repoConfig = array(
375387
'url' => $repoUrl,
376388
'asset-type' => $type,
389+
'asset-repository-manager' => $this->assetRepositoryManager,
377390
'filename' => $filename,
378391
'package-name' => $packageName,
379392
);
@@ -422,6 +435,7 @@ public function testGetComposerInformationWithGitDriver($type, $filename)
422435
$repoConfig = array(
423436
'url' => $repoUrl,
424437
'asset-type' => $type,
438+
'asset-repository-manager' => $this->assetRepositoryManager,
425439
'filename' => $filename,
426440
'no-api' => true,
427441
);
@@ -474,6 +488,7 @@ public function testGetComposerInformationWithCodeCache($type, $filename)
474488
$repoConfig = array(
475489
'url' => $repoUrl,
476490
'asset-type' => $type,
491+
'asset-repository-manager' => $this->assetRepositoryManager,
477492
'filename' => $filename,
478493
'package-name' => $packageName,
479494
);
@@ -516,6 +531,7 @@ public function testGetComposerInformationWithFilesystemCache($type, $filename)
516531
$repoConfig = array(
517532
'url' => $repoUrl,
518533
'asset-type' => $type,
534+
'asset-repository-manager' => $this->assetRepositoryManager,
519535
'filename' => $filename,
520536
'package-name' => $packageName,
521537
);
@@ -571,6 +587,7 @@ public function testGetComposerInformationWithEmptyContent($type, $filename)
571587
$repoConfig = array(
572588
'url' => $repoUrl,
573589
'asset-type' => $type,
590+
'asset-repository-manager' => $this->assetRepositoryManager,
574591
'filename' => $filename,
575592
'package-name' => $packageName,
576593
);
@@ -622,6 +639,7 @@ public function testGetComposerInformationWithRuntimeException($type, $filename)
622639
$repoConfig = array(
623640
'url' => $repoUrl,
624641
'asset-type' => $type,
642+
'asset-repository-manager' => $this->assetRepositoryManager,
625643
'filename' => $filename,
626644
'package-name' => $packageName,
627645
);
@@ -674,6 +692,7 @@ public function testGetComposerInformationWithTransportException($type, $filenam
674692
$repoConfig = array(
675693
'url' => $repoUrl,
676694
'asset-type' => $type,
695+
'asset-repository-manager' => $this->assetRepositoryManager,
677696
'filename' => $filename,
678697
'package-name' => $packageName,
679698
);
@@ -736,6 +755,7 @@ public function testRedirectUrlRepository($type, $filename)
736755
$repoConfig = array(
737756
'url' => $repoUrl,
738757
'asset-type' => $type,
758+
'asset-repository-manager' => $this->assetRepositoryManager,
739759
'filename' => $filename,
740760
'package-name' => $packageName,
741761
);
@@ -836,6 +856,7 @@ public function testRedirectUrlWithNonexistentRepository($type, $filename)
836856
$repoConfig = array(
837857
'url' => $repoUrl,
838858
'asset-type' => $type,
859+
'asset-repository-manager' => $this->assetRepositoryManager,
839860
'filename' => $filename,
840861
'package-name' => $packageName,
841862
);
@@ -892,6 +913,7 @@ public function testRedirectUrlRepositoryWithCache($type, $filename)
892913
$repoConfig = array(
893914
'url' => $repoUrl,
894915
'asset-type' => $type,
916+
'asset-repository-manager' => $this->assetRepositoryManager,
895917
'filename' => $filename,
896918
'package-name' => $packageName,
897919
);
@@ -977,6 +999,7 @@ public function testGetBranchesWithGitDriver($type, $filename, array $branches,
977999
$repoConfig = array(
9781000
'url' => $repoUrl,
9791001
'asset-type' => $type,
1002+
'asset-repository-manager' => $this->assetRepositoryManager,
9801003
'filename' => $filename,
9811004
'no-api' => true,
9821005
);
@@ -1050,6 +1073,7 @@ public function testGetBranches($type, $filename, array $branches)
10501073
$repoConfig = array(
10511074
'url' => $repoUrl,
10521075
'asset-type' => $type,
1076+
'asset-repository-manager' => $this->assetRepositoryManager,
10531077
'filename' => $filename,
10541078
'package-name' => $packageName,
10551079
);
@@ -1086,6 +1110,7 @@ public function testNoApi($type, $filename, array $branches, array $gitBranches)
10861110
$repoConfig = array(
10871111
'url' => $repoUrl,
10881112
'asset-type' => $type,
1113+
'asset-repository-manager' => $this->assetRepositoryManager,
10891114
'filename' => $filename,
10901115
'package-name' => $packageName,
10911116
'vcs-driver-options' => array(

0 commit comments

Comments
 (0)