Skip to content

Commit

Permalink
Some light refactoring before test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Jul 28, 2023
1 parent 778cce4 commit 1a3046b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 3 additions & 7 deletions test/integration/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
use eiriksm\CosyComposerTest\GetExecuterTrait;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\InputDefinition;
use Violinist\Slug\Slug;

abstract class Base extends TestCase
{
use GetCosyTrait;
use GetExecuterTrait;

protected $usesDirect = true;

protected $defaultSha = 123;
Expand Down Expand Up @@ -47,9 +49,6 @@ public function setUp() : void
$this->cosy = $c;
}

use GetCosyTrait;
use GetExecuterTrait;

protected function createExpectedCommandForPackage($package)
{
return ["composer", 'update', '-n', '--no-ansi', $package, '--with-dependencies'];
Expand Down Expand Up @@ -182,9 +181,6 @@ protected function getMockProviderFactory()
protected function setDummyGithubProvider()
{
$mock_provider = $this->getMockProvider();
$slug = new Slug();
$slug->setProvider('github.com');
$slug->setSlug('a/b');
$mock_provider->method('repoIsPrivate')
->willReturn(true);
$mock_provider->method('getDefaultBranch')
Expand Down
10 changes: 6 additions & 4 deletions test/integration/ComposerUpdateIntegrationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ function ($cmd) {
$this->setDummyGithubProvider();
$this->placeInitialComposerLock();
$this->mockProvider = $mock_provider;
$this->mockProvider->method('createPullRequest')
->willReturnCallback(function (Slug $slug, array $params) {
return $this->createPullRequest($slug, $params);
});
if (method_exists($this->mockProvider, 'method')) {
$this->mockProvider->method('createPullRequest')
->willReturnCallback(function (Slug $slug, array $params) {
return $this->createPullRequest($slug, $params);
});
}
}

protected function createPullRequest(Slug $slug, array $params)
Expand Down

0 comments on commit 1a3046b

Please sign in to comment.