Skip to content

Commit 0525ccf

Browse files
authored
Merge pull request #629 from shulard/feature/pull-request-show
Create a new command to show Pull Request details
2 parents 678d9a8 + dd50c77 commit 0525ccf

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/Command/PullRequest/PullRequestShowCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
)
8787
);
8888

89+
if ($pr['milestone'] && $pr['milestone'] instanceof Gitlab\Model\Milestone) {
90+
$pr['milestone'] = $pr['milestone']->title;
91+
}
92+
8993
$styleHelper->detailsTable(
9094
[
9195
['Org/Repo', $input->getOption('org').'/'.$input->getOption('repo')],
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Gush package.
5+
*
6+
* (c) Luis Cordova <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Gush\Tests\Command\PullRequest;
13+
14+
use Gush\Command\PullRequest\PullRequestShowCommand;
15+
use Gush\Tests\Command\CommandTestCase;
16+
use Symfony\Component\Console\Helper\HelperSet;
17+
18+
class PullRequestShowCommandTest extends CommandTestCase
19+
{
20+
/**
21+
* @test
22+
*/
23+
public function it_shows_issue()
24+
{
25+
$tester = $this->getCommandTester($command = new PullRequestShowCommand());
26+
$tester->execute(
27+
[
28+
'id' => 10
29+
]
30+
);
31+
32+
$this->assertCommandOutputMatches(
33+
[
34+
'Pull Request #10 - Write a behat test to launch strategy by weaverryan [open]',
35+
'Org/Repo: gushphp/gush',
36+
'Link: https://github.com/gushphp/gush/pull/10',
37+
'Labels: actionable, easy pick',
38+
'Milestone: some_good_stuff',
39+
'Assignee: cordoval',
40+
'Source => Target: cordoval/gush#head_ref => gushphp/gush#base_ref'
41+
],
42+
$tester->getDisplay()
43+
);
44+
}
45+
}

0 commit comments

Comments
 (0)