public function testOpenPullRequestWithSourceOptionsProvided()
{
$command = new PullRequestCreateCommand();
$tester = $this->getCommandTester($command, null, null, function (HelperSet $helperSet) {
$helperSet->set($this->getLocalGitHelper('sstok', 'gush', 'feat-adapters')->reveal());
$helperSet->set($this->getGitConfigHelper('sstok')->reveal());
});
// use the default title
$this->setExpectedCommandInput($command, "\nInception\n");
$tester->execute(['--template' => 'default', '--source-org' => 'user', '--source-branch' => 'feat-adapters', '--title' => 'Refactored adapter support']);
$display = $tester->getDisplay();
$this->assertCommandOutputMatches(['user wants to merge 1 commit into gushphp/gush:master from user:feat-adapters', 'Opened pull request https://github.com/gushphp/gush/pull/' . TestAdapter::PULL_REQUEST_NUMBER], $display);
$pr = $command->getAdapter()->getPullRequest(TestAdapter::PULL_REQUEST_NUMBER);
$this->assertEquals('Refactored adapter support', $pr['title']);
$this->assertContains('Inception', $pr['body']);
$this->assertEquals('master', $pr['base']['ref']);
$this->assertEquals('user', $pr['head']['user']);
$this->assertEquals('feat-adapters', $pr['head']['ref']);
}