Skip to content

Commit

Permalink
Merge pull request #629 from shulard/feature/pull-request-show
Browse files Browse the repository at this point in the history
Create a new command to show Pull Request details
  • Loading branch information
cordoval committed Dec 14, 2016
2 parents 678d9a8 + dd50c77 commit 0525ccf
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Command/PullRequest/PullRequestShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
)
);

if ($pr['milestone'] && $pr['milestone'] instanceof Gitlab\Model\Milestone) {
$pr['milestone'] = $pr['milestone']->title;
}

$styleHelper->detailsTable(
[
['Org/Repo', $input->getOption('org').'/'.$input->getOption('repo')],
Expand Down
45 changes: 45 additions & 0 deletions tests/Command/PullRequest/PullRequestShowCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/*
* This file is part of Gush package.
*
* (c) Luis Cordova <cordoval@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Gush\Tests\Command\PullRequest;

use Gush\Command\PullRequest\PullRequestShowCommand;
use Gush\Tests\Command\CommandTestCase;
use Symfony\Component\Console\Helper\HelperSet;

class PullRequestShowCommandTest extends CommandTestCase
{
/**
* @test
*/
public function it_shows_issue()
{
$tester = $this->getCommandTester($command = new PullRequestShowCommand());
$tester->execute(
[
'id' => 10
]
);

$this->assertCommandOutputMatches(
[
'Pull Request #10 - Write a behat test to launch strategy by weaverryan [open]',
'Org/Repo: gushphp/gush',
'Link: https://github.com/gushphp/gush/pull/10',
'Labels: actionable, easy pick',
'Milestone: some_good_stuff',
'Assignee: cordoval',
'Source => Target: cordoval/gush#head_ref => gushphp/gush#base_ref'
],
$tester->getDisplay()
);
}
}

0 comments on commit 0525ccf

Please sign in to comment.