Skip to content

Commit f3d92aa

Browse files
committed
Roave#66 Roave#72 Roave#73 isolated tag creation to private method
Ref: Roave#76 (comment)
1 parent a609052 commit f3d92aa

File tree

1 file changed

+26
-54
lines changed

1 file changed

+26
-54
lines changed

test/e2e/Command/AssertBackwardsCompatibleTest.php

+26-54
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,7 @@ public function testWillRunSuccessfullyOnNoBcBreaks() : void
196196

197197
public function testWillPickTaggedVersionOnNoGivenFrom() : void
198198
{
199-
(new Process(
200-
[
201-
'git',
202-
'checkout',
203-
$this->versions[1],
204-
],
205-
$this->sourcesRepository
206-
))->mustRun();
207-
(new Process(
208-
[
209-
'git',
210-
'tag',
211-
'1.2.3',
212-
'-m',
213-
'First tag',
214-
],
215-
$this->sourcesRepository
216-
))->mustRun();
199+
$this->tagOnVersion('1.2.3', 1);
217200

218201
$check = new Process(
219202
[
@@ -241,42 +224,8 @@ public function testWillPickTaggedVersionOnNoGivenFrom() : void
241224

242225
public function testWillPickLatestTaggedVersionOnNoGivenFrom() : void
243226
{
244-
(new Process(
245-
[
246-
'git',
247-
'checkout',
248-
$this->versions[1],
249-
],
250-
$this->sourcesRepository
251-
))->mustRun();
252-
(new Process(
253-
[
254-
'git',
255-
'tag',
256-
'2.2.3',
257-
'-m',
258-
'First tag',
259-
],
260-
$this->sourcesRepository
261-
))->mustRun();
262-
(new Process(
263-
[
264-
'git',
265-
'checkout',
266-
$this->versions[3],
267-
],
268-
$this->sourcesRepository
269-
))->mustRun();
270-
(new Process(
271-
[
272-
'git',
273-
'tag',
274-
'1.2.3',
275-
'-m',
276-
'First tag',
277-
],
278-
$this->sourcesRepository
279-
))->mustRun();
227+
$this->tagOnVersion('2.2.3', 1);
228+
$this->tagOnVersion('1.2.3', 3);
280229

281230
$check = new Process(
282231
[
@@ -301,4 +250,27 @@ public function testWillPickLatestTaggedVersionOnNoGivenFrom() : void
301250
$errorOutput // @TODO https://github.com/Roave/BackwardCompatibilityCheck/issues/79 this looks like a symfony bug - we shouldn't check STDERR, but STDOUT
302251
);
303252
}
253+
254+
private function tagOnVersion(string $tagName, int $version) : void
255+
{
256+
(new Process(
257+
[
258+
'git',
259+
'checkout',
260+
$this->versions[$version],
261+
],
262+
$this->sourcesRepository
263+
))->mustRun();
264+
265+
(new Process(
266+
[
267+
'git',
268+
'tag',
269+
$tagName,
270+
'-m',
271+
'A tag for version ' . $version,
272+
],
273+
$this->sourcesRepository
274+
))->mustRun();
275+
}
304276
}

0 commit comments

Comments
 (0)