diff --git a/infection.json.dist b/infection.json.dist index e91cf76..1a73500 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -24,6 +24,12 @@ "ignore": [ "IonBazan\\ComposerDiff\\Formatter\\AbstractFormatter::terminalLink" ] + }, + "ReturnRemoval": { + "ignore": [ + "IonBazan\\ComposerDiff\\Formatter\\Helper\\Table::getColumnWidth", + "IonBazan\\ComposerDiff\\Command\\DiffCommand::hasDowngrades" + ] } } } diff --git a/src/Url/BitBucketGenerator.php b/src/Url/BitBucketGenerator.php index 2274f90..d7916cc 100644 --- a/src/Url/BitBucketGenerator.php +++ b/src/Url/BitBucketGenerator.php @@ -31,20 +31,20 @@ public function getCompareUrl(PackageInterface $initialPackage, PackageInterface return sprintf( '%s/branches/compare/%s%%0D%s', $baseUrl, - $this->getCompareRef($initialPackage), - $this->getCompareRef($targetPackage) + $this->getCompareRef($targetPackage), + $this->getCompareRef($initialPackage) ); } return sprintf( '%s/branches/compare/%s/%s:%s%%0D%s/%s:%s', $baseUrl, - $baseUser, - $this->getRepo($initialPackage), - $this->getCompareRef($initialPackage), $targetUser, $this->getRepo($targetPackage), - $this->getCompareRef($targetPackage) + $this->getCompareRef($targetPackage), + $baseUser, + $this->getRepo($initialPackage), + $this->getCompareRef($initialPackage) ); } diff --git a/tests/Diff/DiffEntryTest.php b/tests/Diff/DiffEntryTest.php index c02eb4e..f594478 100644 --- a/tests/Diff/DiffEntryTest.php +++ b/tests/Diff/DiffEntryTest.php @@ -97,6 +97,13 @@ public function testCreateWithoutUrlGenerators() $this->assertNull($entry->getProjectUrl()); } + public function testTypeForInvalidOperation() + { + $operation = $this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock(); + $entry = new DiffEntry($operation); + $this->assertSame(DiffEntry::TYPE_CHANGE, $entry->getType()); + } + public function operationUrlProvider() { return array( diff --git a/tests/Url/BitBucketGeneratorTest.php b/tests/Url/BitBucketGeneratorTest.php index 05b3d73..9e1e56a 100644 --- a/tests/Url/BitBucketGeneratorTest.php +++ b/tests/Url/BitBucketGeneratorTest.php @@ -64,32 +64,32 @@ public function compareUrlProvider() 'same maintainer' => array( $this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'), $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package.git'), - 'https://bitbucket.org/acme/package/branches/compare/3.12.0%0D3.12.1', + 'https://bitbucket.org/acme/package/branches/compare/3.12.1%0D3.12.0', ), 'without .git' => array( $this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package'), $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package'), - 'https://bitbucket.org/acme/package/branches/compare/3.12.0%0D3.12.1', + 'https://bitbucket.org/acme/package/branches/compare/3.12.1%0D3.12.0', ), 'dev versions' => array( $this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', 'd46283075d76ed244f7825b378eeb1cee246af73'), $this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', '9b860214d58c48b5cbe99bdb17914d0eb723c9cd'), - 'https://bitbucket.org/acme/package/branches/compare/d462830%0D9b86021', + 'https://bitbucket.org/acme/package/branches/compare/9b86021%0Dd462830', ), 'invalid or short reference' => array( $this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', 'd462830'), $this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', '1'), - 'https://bitbucket.org/acme/package/branches/compare/d462830%0D1', + 'https://bitbucket.org/acme/package/branches/compare/1%0Dd462830', ), 'compare with base fork' => array( $this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/IonBazan/package.git'), $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package.git'), - 'https://bitbucket.org/acme/package/branches/compare/IonBazan/package:3.12.0%0Dacme/package:3.12.1', + 'https://bitbucket.org/acme/package/branches/compare/acme/package:3.12.1%0DIonBazan/package:3.12.0', ), 'compare with head fork' => array( $this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'), $this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/IonBazan/package.git'), - 'https://bitbucket.org/IonBazan/package/branches/compare/acme/package:3.12.0%0DIonBazan/package:3.12.1', + 'https://bitbucket.org/IonBazan/package/branches/compare/IonBazan/package:3.12.1%0Dacme/package:3.12.0', ), 'compare with different repository provider' => array( $this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'),