Skip to content

Commit 46a1688

Browse files
indykoningIonBazan
andauthored
Flip Bitbucket versions for compare (#45)
* Flip versions for compare * fix test * Fix mutation tests --------- Co-authored-by: Ion Bazan <ion.bazan@gmail.com>
1 parent 5eb28ba commit 46a1688

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

infection.json.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
"ignore": [
2525
"IonBazan\\ComposerDiff\\Formatter\\AbstractFormatter::terminalLink"
2626
]
27+
},
28+
"ReturnRemoval": {
29+
"ignore": [
30+
"IonBazan\\ComposerDiff\\Formatter\\Helper\\Table::getColumnWidth",
31+
"IonBazan\\ComposerDiff\\Command\\DiffCommand::hasDowngrades"
32+
]
2733
}
2834
}
2935
}

src/Url/BitBucketGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ public function getCompareUrl(PackageInterface $initialPackage, PackageInterface
3131
return sprintf(
3232
'%s/branches/compare/%s%%0D%s',
3333
$baseUrl,
34-
$this->getCompareRef($initialPackage),
35-
$this->getCompareRef($targetPackage)
34+
$this->getCompareRef($targetPackage),
35+
$this->getCompareRef($initialPackage)
3636
);
3737
}
3838

3939
return sprintf(
4040
'%s/branches/compare/%s/%s:%s%%0D%s/%s:%s',
4141
$baseUrl,
42-
$baseUser,
43-
$this->getRepo($initialPackage),
44-
$this->getCompareRef($initialPackage),
4542
$targetUser,
4643
$this->getRepo($targetPackage),
47-
$this->getCompareRef($targetPackage)
44+
$this->getCompareRef($targetPackage),
45+
$baseUser,
46+
$this->getRepo($initialPackage),
47+
$this->getCompareRef($initialPackage)
4848
);
4949
}
5050

tests/Diff/DiffEntryTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ public function testCreateWithoutUrlGenerators()
9797
$this->assertNull($entry->getProjectUrl());
9898
}
9999

100+
public function testTypeForInvalidOperation()
101+
{
102+
$operation = $this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock();
103+
$entry = new DiffEntry($operation);
104+
$this->assertSame(DiffEntry::TYPE_CHANGE, $entry->getType());
105+
}
106+
100107
public function operationUrlProvider()
101108
{
102109
return array(

tests/Url/BitBucketGeneratorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,32 @@ public function compareUrlProvider()
6464
'same maintainer' => array(
6565
$this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'),
6666
$this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package.git'),
67-
'https://bitbucket.org/acme/package/branches/compare/3.12.0%0D3.12.1',
67+
'https://bitbucket.org/acme/package/branches/compare/3.12.1%0D3.12.0',
6868
),
6969
'without .git' => array(
7070
$this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package'),
7171
$this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package'),
72-
'https://bitbucket.org/acme/package/branches/compare/3.12.0%0D3.12.1',
72+
'https://bitbucket.org/acme/package/branches/compare/3.12.1%0D3.12.0',
7373
),
7474
'dev versions' => array(
7575
$this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', 'd46283075d76ed244f7825b378eeb1cee246af73'),
7676
$this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', '9b860214d58c48b5cbe99bdb17914d0eb723c9cd'),
77-
'https://bitbucket.org/acme/package/branches/compare/d462830%0D9b86021',
77+
'https://bitbucket.org/acme/package/branches/compare/9b86021%0Dd462830',
7878
),
7979
'invalid or short reference' => array(
8080
$this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', 'd462830'),
8181
$this->getPackageWithSource('acme/package', 'dev-master', 'https://bitbucket.org/acme/package.git', '1'),
82-
'https://bitbucket.org/acme/package/branches/compare/d462830%0D1',
82+
'https://bitbucket.org/acme/package/branches/compare/1%0Dd462830',
8383
),
8484
'compare with base fork' => array(
8585
$this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/IonBazan/package.git'),
8686
$this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/acme/package.git'),
87-
'https://bitbucket.org/acme/package/branches/compare/IonBazan/package:3.12.0%0Dacme/package:3.12.1',
87+
'https://bitbucket.org/acme/package/branches/compare/acme/package:3.12.1%0DIonBazan/package:3.12.0',
8888
),
8989
'compare with head fork' => array(
9090
$this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'),
9191
$this->getPackageWithSource('acme/package', '3.12.1', 'https://bitbucket.org/IonBazan/package.git'),
92-
'https://bitbucket.org/IonBazan/package/branches/compare/acme/package:3.12.0%0DIonBazan/package:3.12.1',
92+
'https://bitbucket.org/IonBazan/package/branches/compare/IonBazan/package:3.12.1%0Dacme/package:3.12.0',
9393
),
9494
'compare with different repository provider' => array(
9595
$this->getPackageWithSource('acme/package', '3.12.0', 'https://bitbucket.org/acme/package.git'),

0 commit comments

Comments
 (0)