-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace eiriksm\CosyComposerTest\integration; | ||
|
||
use Github\Exception\ValidationFailedException; | ||
use Violinist\Slug\Slug; | ||
|
||
abstract class AutoMergeBase extends ComposerUpdateIntegrationBase | ||
{ | ||
protected $isUpdate = false; | ||
|
||
protected function getBranchesFlattened() | ||
{ | ||
if (!$this->isUpdate) { | ||
return []; | ||
} | ||
return ['psrlog113114']; | ||
} | ||
|
||
protected function createPullRequest(Slug $slug, array $params) | ||
{ | ||
if (!$this->isUpdate) { | ||
return parent::createPullRequest($slug, $params); | ||
} | ||
throw new ValidationFailedException('I want you to update please'); | ||
} | ||
|
||
protected function getPrsNamed() | ||
{ | ||
if (!$this->isUpdate) { | ||
return []; | ||
} | ||
return [ | ||
'psrlog113114' => [ | ||
'base' => [ | ||
'sha' => 456, | ||
], | ||
'title' => 'not the same as the other', | ||
'number' => 666, | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider getUpdateVariations | ||
*/ | ||
public function testAutomerge($should_have_updated) | ||
{ | ||
$this->isUpdate = $should_have_updated; | ||
$this->checkPrUrl = !$should_have_updated; | ||
$this->runtestExpectedOutput(); | ||
} | ||
|
||
public function getUpdateVariations() | ||
{ | ||
return [ | ||
[true], | ||
[false], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters