private function getLocalGitHelper($message = null, $squash = false, $forceSquash = false, $switch = null, $withComments = true, $fastForward = false)
{
$helper = parent::getGitHelper();
if ($withComments) {
$helper->remoteUpdate('gushphp')->shouldBeCalled();
$helper->addNotes(Argument::any(), self::MERGE_HASH, 'github-comments')->shouldBeCalled();
$helper->pushToRemote('gushphp', 'refs/notes/github-comments')->shouldBeCalled();
}
if (null !== $message) {
$mergeOperation = $this->prophesize(RemoteMergeOperation::class);
$mergeOperation->setTarget('gushphp', 'base_ref')->shouldBeCalled();
$mergeOperation->setSource('cordoval', 'head_ref')->shouldBeCalled();
$mergeOperation->squashCommits($squash, $forceSquash)->shouldBeCalled();
$mergeOperation->switchBase($switch)->shouldBeCalled();
$mergeOperation->useFastForward($fastForward)->shouldBeCalled();
$mergeOperation->setMergeMessage(Argument::that(function ($closure) use($message, $switch) {
$closureMessage = trim($closure($switch ?: 'base_ref', 'temp--head_ref'));
$result = trim($message) === $closureMessage;
return $result;
}))->shouldBeCalled();
$mergeOperation->performMerge()->willReturn(self::MERGE_HASH);
$mergeOperation->pushToRemote()->shouldBeCalled();
$helper->createRemoteMergeOperation()->willReturn($mergeOperation->reveal());
$helper->getLogBetweenCommits($switch ?: 'base_ref', 'temp--head_ref')->willReturn($squash ? $this->squashedCommits : $this->commits);
}
return $helper;
}