From 7e268f2a77d5044ea7848d74661cb538da62c5ed Mon Sep 17 00:00:00 2001 From: Joshua Gigg Date: Thu, 6 Jan 2022 09:55:28 +0000 Subject: [PATCH 1/2] Add Project Links Closes #5 --- src/Formatter/AbstractFormatter.php | 27 ++++++++++++++ src/Formatter/JsonFormatter.php | 2 ++ src/Formatter/MarkdownListFormatter.php | 12 +++++-- src/Formatter/MarkdownTableFormatter.php | 17 ++++++--- src/Url/BitBucketGenerator.php | 8 +++++ src/Url/GithubGenerator.php | 8 +++++ src/Url/GitlabGenerator.php | 8 +++++ src/Url/UrlGenerator.php | 5 +++ tests/Command/DiffCommandTest.php | 36 +++++++++---------- tests/Formatter/FormatterTest.php | 3 ++ tests/Formatter/JsonFormatterTest.php | 16 +++++++++ tests/Formatter/MarkdownListFormatterTest.php | 10 +++--- .../Formatter/MarkdownTableFormatterTest.php | 28 +++++++-------- 13 files changed, 135 insertions(+), 45 deletions(-) diff --git a/src/Formatter/AbstractFormatter.php b/src/Formatter/AbstractFormatter.php index b8c177b..d617929 100644 --- a/src/Formatter/AbstractFormatter.php +++ b/src/Formatter/AbstractFormatter.php @@ -3,6 +3,7 @@ namespace IonBazan\ComposerDiff\Formatter; use Composer\DependencyResolver\Operation\InstallOperation; +use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\Package\PackageInterface; @@ -46,6 +47,32 @@ public function getUrl(DiffEntry $entry) return null; } + /** + * @return string|null + */ + public function getProjectUrl(OperationInterface $operation) + { + if ($operation instanceof UpdateOperation) { + $package = $operation->getInitialPackage(); + } + + if ($operation instanceof InstallOperation || $operation instanceof UninstallOperation) { + $package = $operation->getPackage(); + } + + if (!isset($package)) { + return null; + } + + $generator = $this->generators->get($package); + + if (!$generator) { + return null; + } + + return $generator->getProjectUrl($package); + } + /** * @return string|null */ diff --git a/src/Formatter/JsonFormatter.php b/src/Formatter/JsonFormatter.php index 6697d01..dac9d73 100644 --- a/src/Formatter/JsonFormatter.php +++ b/src/Formatter/JsonFormatter.php @@ -3,6 +3,7 @@ namespace IonBazan\ComposerDiff\Formatter; use Composer\DependencyResolver\Operation\InstallOperation; +use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UpdateOperation; use IonBazan\ComposerDiff\Diff\DiffEntries; @@ -53,6 +54,7 @@ private function transformEntries(DiffEntries $entries, $withUrls) if ($withUrls) { $row['compare'] = $this->getUrl($entry); + $row['link'] = $this->getProjectUrl($entry->getOperation()); } $rows[$row['name']] = $row; diff --git a/src/Formatter/MarkdownListFormatter.php b/src/Formatter/MarkdownListFormatter.php index 9c4f7f3..8005657 100644 --- a/src/Formatter/MarkdownListFormatter.php +++ b/src/Formatter/MarkdownListFormatter.php @@ -51,19 +51,23 @@ private function getRow(DiffEntry $entry, $withUrls) $operation = $entry->getOperation(); if ($operation instanceof InstallOperation) { + $packageName = $operation->getPackage()->getName(); + $packageUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return sprintf( ' - Install %s (%s)%s', - $operation->getPackage()->getName(), + $packageUrl ?: $packageName, $operation->getPackage()->getFullPrettyVersion(), $url ); } if ($operation instanceof UpdateOperation) { + $packageName = $operation->getInitialPackage()->getName(); + $projectUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return sprintf( ' - %s %s (%s => %s)%s', ucfirst($entry->getType()), - $operation->getInitialPackage()->getName(), + $projectUrl ?: $packageName, $operation->getInitialPackage()->getFullPrettyVersion(), $operation->getTargetPackage()->getFullPrettyVersion(), $url @@ -71,9 +75,11 @@ private function getRow(DiffEntry $entry, $withUrls) } if ($operation instanceof UninstallOperation) { + $packageName = $operation->getPackage()->getName(); + $packageUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return sprintf( ' - Uninstall %s (%s)%s', - $operation->getPackage()->getName(), + $packageUrl ?: $packageName, $operation->getPackage()->getFullPrettyVersion(), $url ); diff --git a/src/Formatter/MarkdownTableFormatter.php b/src/Formatter/MarkdownTableFormatter.php index d0a02bb..d5dcc5b 100644 --- a/src/Formatter/MarkdownTableFormatter.php +++ b/src/Formatter/MarkdownTableFormatter.php @@ -32,7 +32,7 @@ public function renderSingle(DiffEntries $entries, $title, $withUrls) $rows = array(); foreach ($entries as $entry) { - $row = $this->getTableRow($entry); + $row = $this->getTableRow($entry, $withUrls); if ($withUrls) { $row[] = $this->formatUrl($this->getUrl($entry), 'Compare'); @@ -53,14 +53,17 @@ public function renderSingle(DiffEntries $entries, $title, $withUrls) } /** + * @param bool $withUrls * @return string[] */ - private function getTableRow(DiffEntry $entry) + private function getTableRow(DiffEntry $entry, $withUrls) { $operation = $entry->getOperation(); if ($operation instanceof InstallOperation) { + $packageName = $operation->getPackage()->getName(); + $packageUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return array( - $operation->getPackage()->getName(), + $packageUrl ?: $packageName, 'New', '-', $operation->getPackage()->getFullPrettyVersion(), @@ -68,8 +71,10 @@ private function getTableRow(DiffEntry $entry) } if ($operation instanceof UpdateOperation) { + $packageName = $operation->getInitialPackage()->getName(); + $projectUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return array( - $operation->getInitialPackage()->getName(), + $projectUrl ?: $packageName, $entry->isChange() ? 'Changed' : ($entry->isUpgrade() ? 'Upgraded' : 'Downgraded'), $operation->getInitialPackage()->getFullPrettyVersion(), $operation->getTargetPackage()->getFullPrettyVersion(), @@ -77,8 +82,10 @@ private function getTableRow(DiffEntry $entry) } if ($operation instanceof UninstallOperation) { + $packageName = $operation->getPackage()->getName(); + $packageUrl = $withUrls ? $this->formatUrl($this->getProjectUrl($operation), $packageName) : $packageName; return array( - $operation->getPackage()->getName(), + $packageUrl ?: $packageName, 'Removed', $operation->getPackage()->getFullPrettyVersion(), '-', diff --git a/src/Url/BitBucketGenerator.php b/src/Url/BitBucketGenerator.php index c0ab910..2274f90 100644 --- a/src/Url/BitBucketGenerator.php +++ b/src/Url/BitBucketGenerator.php @@ -55,4 +55,12 @@ public function getReleaseUrl(PackageInterface $package) { return sprintf('%s/src/%s', $this->getRepositoryUrl($package), $package->isDev() ? $package->getSourceReference() : $package->getPrettyVersion()); } + + /** + * {@inheritdoc} + */ + public function getProjectUrl(PackageInterface $package) + { + return $this->getRepositoryUrl($package); + } } diff --git a/src/Url/GithubGenerator.php b/src/Url/GithubGenerator.php index d699dd6..c111f78 100644 --- a/src/Url/GithubGenerator.php +++ b/src/Url/GithubGenerator.php @@ -35,6 +35,14 @@ public function getReleaseUrl(PackageInterface $package) return sprintf('%s/releases/tag/%s', $this->getRepositoryUrl($package), $package->getPrettyVersion()); } + /** + * {@inheritdoc} + */ + public function getProjectUrl(PackageInterface $package) + { + return $this->getRepositoryUrl($package); + } + /** * {@inheritdoc} */ diff --git a/src/Url/GitlabGenerator.php b/src/Url/GitlabGenerator.php index b264134..1380e6a 100644 --- a/src/Url/GitlabGenerator.php +++ b/src/Url/GitlabGenerator.php @@ -58,4 +58,12 @@ public function getReleaseUrl(PackageInterface $package) return sprintf('%s/tags/%s', $this->getRepositoryUrl($package), $package->getPrettyVersion()); } + + /** + * {@inheritdoc} + */ + public function getProjectUrl(PackageInterface $package) + { + return $this->getRepositoryUrl($package); + } } diff --git a/src/Url/UrlGenerator.php b/src/Url/UrlGenerator.php index d7c6e5c..0599bf9 100644 --- a/src/Url/UrlGenerator.php +++ b/src/Url/UrlGenerator.php @@ -20,4 +20,9 @@ public function getCompareUrl(PackageInterface $initialPackage, PackageInterface * @return string|null */ public function getReleaseUrl(PackageInterface $package); + + /** + * @return string|null + */ + public function getProjectUrl(PackageInterface $package); } diff --git a/tests/Command/DiffCommandTest.php b/tests/Command/DiffCommandTest.php index b509d02..f672348 100644 --- a/tests/Command/DiffCommandTest.php +++ b/tests/Command/DiffCommandTest.php @@ -134,15 +134,15 @@ public function outputDataProvider() ), 'Markdown with URLs' => array( << array( <<method('getReleaseUrl')->willReturnCallback(function (PackageInterface $package) { return sprintf('https://example.com/r/%s', $package->getVersion()); }); + $generator->method('getProjectUrl')->willReturnCallback(function (PackageInterface $package) { + return sprintf('https://example.com/r/%s', $package->getName()); + }); $generators = $this->getMockBuilder('IonBazan\ComposerDiff\Url\GeneratorContainer') ->disableOriginalConstructor() diff --git a/tests/Formatter/JsonFormatterTest.php b/tests/Formatter/JsonFormatterTest.php index d5df1be..6f541fd 100644 --- a/tests/Formatter/JsonFormatterTest.php +++ b/tests/Formatter/JsonFormatterTest.php @@ -35,6 +35,7 @@ public function testRenderSingle() 'version_base' => null, 'version_target' => '1.0.0', 'compare' => 'https://example.com/r/1.0.0', + 'link' => 'https://example.com/r/a/package-1', ), 'a/no-link-1' => array( 'name' => 'a/no-link-1', @@ -42,6 +43,7 @@ public function testRenderSingle() 'version_base' => null, 'version_target' => '1.0.0', 'compare' => null, + 'link' => null, ), 'a/package-2' => array( 'name' => 'a/package-2', @@ -49,6 +51,7 @@ public function testRenderSingle() 'version_base' => '1.0.0', 'version_target' => '1.2.0', 'compare' => 'https://example.com/c/1.0.0..1.2.0', + 'link' => 'https://example.com/r/a/package-2', ), 'a/package-3' => array( 'name' => 'a/package-3', @@ -56,6 +59,7 @@ public function testRenderSingle() 'version_base' => '2.0.0', 'version_target' => '1.1.1', 'compare' => 'https://example.com/c/2.0.0..1.1.1', + 'link' => 'https://example.com/r/a/package-3', ), 'a/no-link-2' => array( 'name' => 'a/no-link-2', @@ -63,6 +67,7 @@ public function testRenderSingle() 'version_base' => '0.1.1', 'version_target' => null, 'compare' => null, + 'link' => null, ), 'a/package-5' => array( 'name' => 'a/package-5', @@ -70,6 +75,7 @@ public function testRenderSingle() 'version_base' => 'dev-master 1234567', 'version_target' => '1.1.1', 'compare' => 'https://example.com/c/dev-master..1.1.1', + 'link' => 'https://example.com/r/a/package-5', ), 'a/package-4' => array( 'name' => 'a/package-4', @@ -77,6 +83,7 @@ public function testRenderSingle() 'version_base' => '0.1.1', 'version_target' => null, 'compare' => 'https://example.com/r/0.1.1', + 'link' => 'https://example.com/r/a/package-4', ), )), $this->getDisplay($output)); } @@ -92,6 +99,7 @@ protected function getSampleOutput($withUrls) 'version_base' => null, 'version_target' => '1.0.0', 'compare' => 'https://example.com/r/1.0.0', + 'link' => 'https://example.com/r/a/package-1', ), 'a/no-link-1' => array( 'name' => 'a/no-link-1', @@ -99,6 +107,7 @@ protected function getSampleOutput($withUrls) 'version_base' => null, 'version_target' => '1.0.0', 'compare' => null, + 'link' => null, ), 'a/package-2' => array( 'name' => 'a/package-2', @@ -106,6 +115,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '1.0.0', 'version_target' => '1.2.0', 'compare' => 'https://example.com/c/1.0.0..1.2.0', + 'link' => 'https://example.com/r/a/package-2', ), 'a/package-3' => array( 'name' => 'a/package-3', @@ -113,6 +123,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '2.0.0', 'version_target' => '1.1.1', 'compare' => 'https://example.com/c/2.0.0..1.1.1', + 'link' => 'https://example.com/r/a/package-3', ), 'a/no-link-2' => array( 'name' => 'a/no-link-2', @@ -120,6 +131,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '2.0.0', 'version_target' => '1.1.1', 'compare' => null, + 'link' => null, ), 'php' => array( 'name' => 'php', @@ -127,6 +139,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '>=7.4.6', 'version_target' => '^8.0', 'compare' => null, + 'link' => null, ), ), 'packages-dev' => array( @@ -136,6 +149,7 @@ protected function getSampleOutput($withUrls) 'version_base' => 'dev-master 1234567', 'version_target' => '1.1.1', 'compare' => 'https://example.com/c/dev-master..1.1.1', + 'link' => 'https://example.com/r/a/package-5', ), 'a/package-4' => array( 'name' => 'a/package-4', @@ -143,6 +157,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '0.1.1', 'version_target' => null, 'compare' => 'https://example.com/r/0.1.1', + 'link' => 'https://example.com/r/a/package-4', ), 'a/no-link-2' => array( 'name' => 'a/no-link-2', @@ -150,6 +165,7 @@ protected function getSampleOutput($withUrls) 'version_base' => '0.1.1', 'version_target' => null, 'compare' => null, + 'link' => null, ), ), )); diff --git a/tests/Formatter/MarkdownListFormatterTest.php b/tests/Formatter/MarkdownListFormatterTest.php index 7f97ac8..144facf 100644 --- a/tests/Formatter/MarkdownListFormatterTest.php +++ b/tests/Formatter/MarkdownListFormatterTest.php @@ -15,18 +15,18 @@ protected function getSampleOutput($withUrls) Prod Packages ============= - - Install a/package-1 (1.0.0) [Compare](https://example.com/r/1.0.0) + - Install [a/package-1](https://example.com/r/a/package-1) (1.0.0) [Compare](https://example.com/r/1.0.0) - Install a/no-link-1 (1.0.0) - - Upgrade a/package-2 (1.0.0 => 1.2.0) [Compare](https://example.com/c/1.0.0..1.2.0) - - Downgrade a/package-3 (2.0.0 => 1.1.1) [Compare](https://example.com/c/2.0.0..1.1.1) + - Upgrade [a/package-2](https://example.com/r/a/package-2) (1.0.0 => 1.2.0) [Compare](https://example.com/c/1.0.0..1.2.0) + - Downgrade [a/package-3](https://example.com/r/a/package-3) (2.0.0 => 1.1.1) [Compare](https://example.com/c/2.0.0..1.1.1) - Downgrade a/no-link-2 (2.0.0 => 1.1.1) - Change php (>=7.4.6 => ^8.0) Dev Packages ============ - - Change a/package-5 (dev-master 1234567 => 1.1.1) [Compare](https://example.com/c/dev-master..1.1.1) - - Uninstall a/package-4 (0.1.1) [Compare](https://example.com/r/0.1.1) + - Change [a/package-5](https://example.com/r/a/package-5) (dev-master 1234567 => 1.1.1) [Compare](https://example.com/c/dev-master..1.1.1) + - Uninstall [a/package-4](https://example.com/r/a/package-4) (0.1.1) [Compare](https://example.com/r/0.1.1) - Uninstall a/no-link-2 (0.1.1) diff --git a/tests/Formatter/MarkdownTableFormatterTest.php b/tests/Formatter/MarkdownTableFormatterTest.php index 1d1ba76..f8a5873 100644 --- a/tests/Formatter/MarkdownTableFormatterTest.php +++ b/tests/Formatter/MarkdownTableFormatterTest.php @@ -12,20 +12,20 @@ protected function getSampleOutput($withUrls) { if ($withUrls) { return <<=7.4.6 | ^8.0 | | - -| Dev Packages | Operation | Base | Target | Link | -|--------------|-----------|--------------------|--------|----------------------------------------------------| -| a/package-5 | Changed | dev-master 1234567 | 1.1.1 | [Compare](https://example.com/c/dev-master..1.1.1) | -| a/package-4 | Removed | 0.1.1 | - | [Compare](https://example.com/r/0.1.1) | -| a/no-link-2 | Removed | 0.1.1 | - | | +| Prod Packages | Operation | Base | Target | Link | +|--------------------------------------------------|------------|---------|--------|-----------------------------------------------| +| [a/package-1](https://example.com/r/a/package-1) | New | - | 1.0.0 | [Compare](https://example.com/r/1.0.0) | +| a/no-link-1 | New | - | 1.0.0 | | +| [a/package-2](https://example.com/r/a/package-2) | Upgraded | 1.0.0 | 1.2.0 | [Compare](https://example.com/c/1.0.0..1.2.0) | +| [a/package-3](https://example.com/r/a/package-3) | Downgraded | 2.0.0 | 1.1.1 | [Compare](https://example.com/c/2.0.0..1.1.1) | +| a/no-link-2 | Downgraded | 2.0.0 | 1.1.1 | | +| php | Changed | >=7.4.6 | ^8.0 | | + +| Dev Packages | Operation | Base | Target | Link | +|--------------------------------------------------|-----------|--------------------|--------|----------------------------------------------------| +| [a/package-5](https://example.com/r/a/package-5) | Changed | dev-master 1234567 | 1.1.1 | [Compare](https://example.com/c/dev-master..1.1.1) | +| [a/package-4](https://example.com/r/a/package-4) | Removed | 0.1.1 | - | [Compare](https://example.com/r/0.1.1) | +| a/no-link-2 | Removed | 0.1.1 | - | | OUTPUT; From 347c7ee1698ae3ebbf9516a18f731a7a690b8d55 Mon Sep 17 00:00:00 2001 From: Joshua Gigg Date: Thu, 6 Jan 2022 10:31:16 +0000 Subject: [PATCH 2/2] Improve test coverage --- tests/Formatter/FormatterTest.php | 8 +++++++ tests/Url/BitBucketGeneratorTest.php | 26 +++++++++++++++++++++ tests/Url/GeneratorTest.php | 12 ++++++++++ tests/Url/GithubGeneratorTest.php | 26 +++++++++++++++++++++ tests/Url/GitlabGeneratorTest.php | 34 ++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) diff --git a/tests/Formatter/FormatterTest.php b/tests/Formatter/FormatterTest.php index 624722a..2514996 100644 --- a/tests/Formatter/FormatterTest.php +++ b/tests/Formatter/FormatterTest.php @@ -33,6 +33,14 @@ public function testGetUrlReturnsNullForInvalidOperation() $this->assertNull($formatter->getUrl(new DiffEntry($operation))); } + public function testGetProjectUrlReturnsNullForInvalidOperation() + { + $output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); + $operation = $this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock(); + $formatter = $this->getFormatter($output, $this->getGenerators()); + $this->assertNull($formatter->getProjectUrl($operation)); + } + /** * @param bool $withUrls * diff --git a/tests/Url/BitBucketGeneratorTest.php b/tests/Url/BitBucketGeneratorTest.php index 35b8e0f..05b3d73 100644 --- a/tests/Url/BitBucketGeneratorTest.php +++ b/tests/Url/BitBucketGeneratorTest.php @@ -32,6 +32,32 @@ public function releaseUrlProvider() ); } + public function projectUrlProvider() + { + return array( + 'with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package.git'), + 'https://bitbucket.org/acme/package', + ), + 'without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package'), + 'https://bitbucket.org/acme/package', + ), + 'ssh with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@bitbucket.org:acme/package.git'), + 'https://bitbucket.org/acme/package', + ), + 'ssh without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@bitbucket.org:acme/package'), + 'https://bitbucket.org/acme/package', + ), + 'dev version' => array( + $this->getPackageWithSource('acme/package', 'dev-master', 'git@bitbucket.org:acme/package', 'd46283075d76ed244f7825b378eeb1cee246af73'), + 'https://bitbucket.org/acme/package', + ), + ); + } + public function compareUrlProvider() { return array( diff --git a/tests/Url/GeneratorTest.php b/tests/Url/GeneratorTest.php index b09b158..b75bb20 100644 --- a/tests/Url/GeneratorTest.php +++ b/tests/Url/GeneratorTest.php @@ -28,10 +28,22 @@ public function testReleaseUrl(PackageInterface $package, $expectedUrl) $this->assertSame($expectedUrl, $this->getGenerator()->getReleaseUrl($package)); } + /** + * @param string|null $expectedUrl + * + * @dataProvider projectUrlProvider + */ + public function testProjectUrl(PackageInterface $package, $expectedUrl) + { + $this->assertSame($expectedUrl, $this->getGenerator()->getProjectUrl($package)); + } + abstract public function compareUrlProvider(); abstract public function releaseUrlProvider(); + abstract public function projectUrlProvider(); + /** * @return UrlGenerator */ diff --git a/tests/Url/GithubGeneratorTest.php b/tests/Url/GithubGeneratorTest.php index f9cd118..a589759 100644 --- a/tests/Url/GithubGeneratorTest.php +++ b/tests/Url/GithubGeneratorTest.php @@ -38,6 +38,32 @@ public function releaseUrlProvider() ); } + public function projectUrlProvider() + { + return array( + 'with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/acme/package.git'), + 'https://github.com/acme/package', + ), + 'without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://github.com/acme/package'), + 'https://github.com/acme/package', + ), + 'ssh with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@github.com:acme/package.git'), + 'https://github.com/acme/package', + ), + 'ssh without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@github.com:acme/package'), + 'https://github.com/acme/package', + ), + 'dev version' => array( + $this->getPackageWithSource('acme/package', 'dev-master', 'git@github.com:acme/package'), + 'https://github.com/acme/package', + ), + ); + } + public function compareUrlProvider() { return array( diff --git a/tests/Url/GitlabGeneratorTest.php b/tests/Url/GitlabGeneratorTest.php index 6c9ec71..d5524d1 100644 --- a/tests/Url/GitlabGeneratorTest.php +++ b/tests/Url/GitlabGeneratorTest.php @@ -40,6 +40,40 @@ public function releaseUrlProvider() ); } + public function projectUrlProvider() + { + return array( + 'with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://gitlab.acme.org/acme/package.git'), + 'https://gitlab.acme.org/acme/package', + ), + 'without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'https://gitlab.acme.org/acme/package'), + 'https://gitlab.acme.org/acme/package', + ), + 'ssh with .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@gitlab.acme.org:acme/package.git'), + 'https://gitlab.acme.org/acme/package', + ), + 'ssh without .git' => array( + $this->getPackageWithSource('acme/package', '3.12.1', 'git@gitlab.acme.org:acme/package'), + 'https://gitlab.acme.org/acme/package', + ), + 'dev version' => array( + $this->getPackageWithSource('acme/package', 'dev-master', 'git@gitlab.acme.org:ac/me/package'), + 'https://gitlab.acme.org/ac/me/package', + ), + 'https in subgroup' => array( + $this->getPackageWithSource('ac/me/package', '3.12.1', 'https://gitlab.acme.org/ac/me/package.git'), + 'https://gitlab.acme.org/ac/me/package', + ), + 'ssh in subgroup' => array( + $this->getPackageWithSource('ac/me/package', '3.12.1', 'git@gitlab.acme.org:ac/me/package.git'), + 'https://gitlab.acme.org/ac/me/package', + ), + ); + } + public function compareUrlProvider() { return array(