diff --git a/src/Artifact.php b/src/Artifact.php index 2a00387..b14b317 100644 --- a/src/Artifact.php +++ b/src/Artifact.php @@ -47,37 +47,37 @@ class Artifact { /** * Original branch in current repository. * - * @var string + * @var string|null */ - protected string $originalBranch; + protected ?string $originalBranch = NULL; /** * Destination branch with optional tokens. * - * @var string + * @var string|null */ - protected string $destinationBranch; + protected ?string $destinationBranch = NULL; /** * Local branch where artifact will be built. * - * @var string + * @var string|null */ - protected string $artifactBranch; + protected ?string $artifactBranch = NULL; /** * Remote name. * - * @var string + * @var string|null */ - protected string $remoteName; + protected ?string $remoteName = NULL; /** * Remote URL includes uri or local path. * - * @var string + * @var string|null */ - protected string $remoteUrl; + protected ?string $remoteUrl = NULL; /** * Gitignore file to be used during artifact creation. @@ -91,23 +91,23 @@ class Artifact { /** * Commit message with optional tokens. * - * @var string + * @var string|null */ - protected string $message; + protected ?string $message = NULL; /** * Flag to specify if push is required or should be using dry run. * * @var bool */ - protected bool $needsPush; + protected bool $needsPush = FALSE; /** * Flag to specify if cleanup is required to run after the build. * * @var bool */ - protected bool $needCleanup; + protected bool $needCleanup = TRUE; /** * Path to report file. diff --git a/src/GitArtifactGitRepository.php b/src/GitArtifactGitRepository.php index e5d67d7..49e6d18 100644 --- a/src/GitArtifactGitRepository.php +++ b/src/GitArtifactGitRepository.php @@ -9,7 +9,7 @@ use Symfony\Component\Filesystem\Filesystem; /** - * + * Artifact git repository. */ class GitArtifactGitRepository extends GitRepository { @@ -126,38 +126,6 @@ public function removeRemote($name): GitArtifactGitRepository { return $this; } - /** - * Get remote list. - * - * @return array|null - * Remotes. - * - * @throws \CzProject\GitPhp\GitException - */ - public function getRemotes(): ?array { - return $this->extractFromCommand(['remote']); - } - - /** - * Check remote is existing or not by remote name. - * - * @param string $remoteName - * Remote name to check. - * - * @return bool - * Exist or not. - * - * @throws \CzProject\GitPhp\GitException - */ - public function isRemoteExists(string $remoteName): bool { - $remotes = $this->getRemotes(); - if (empty($remotes)) { - return FALSE; - } - - return in_array($remoteName, $remotes); - } - /** * Check if provided location is a URI. * diff --git a/tests/phpunit/Functional/GeneralTest.php b/tests/phpunit/Functional/GeneralTest.php index c6da843..c8c4e99 100644 --- a/tests/phpunit/Functional/GeneralTest.php +++ b/tests/phpunit/Functional/GeneralTest.php @@ -29,7 +29,6 @@ public function testCompulsoryParameter(): void { public function testInfo(): void { $this->gitCreateFixtureCommits(1); $output = $this->runBuild(); - $this->assertStringContainsString('Artifact information', $output); $this->assertStringContainsString('Mode: force-push', $output); $this->assertStringContainsString('Source repository: ' . $this->src, $output); diff --git a/tests/phpunit/Unit/AbstractUnitTestCase.php b/tests/phpunit/Unit/AbstractUnitTestCase.php index 04ec16a..298c677 100644 --- a/tests/phpunit/Unit/AbstractUnitTestCase.php +++ b/tests/phpunit/Unit/AbstractUnitTestCase.php @@ -3,6 +3,7 @@ namespace DrevOps\GitArtifact\Tests\Unit; use DrevOps\GitArtifact\Artifact; +use DrevOps\GitArtifact\GitArtifactGit; use DrevOps\GitArtifact\Tests\AbstractTestCase; use GitWrapper\GitWrapper; use Symfony\Component\Console\Output\ConsoleOutput; @@ -25,7 +26,7 @@ protected function setUp(): void { $mockBuilder = $this->getMockBuilder(Artifact::class); $fileSystem = new Filesystem(); - $gitWrapper = new GitWrapper(); + $gitWrapper = new GitArtifactGit(); $output = new ConsoleOutput(); $mockBuilder->setConstructorArgs([$gitWrapper, $fileSystem, $output]);