-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
6c09a8b
commit 775dae5
Showing
23 changed files
with
875 additions
and
126 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Console; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\Console\Application; | ||
use SonsOfPHP\Bard\Console\Command\AddCommand; | ||
use SonsOfPHP\Bard\Console\Command\CopyCommand; | ||
use SonsOfPHP\Bard\Console\Command\InitCommand; | ||
use SonsOfPHP\Bard\Console\Command\InstallCommand; | ||
use SonsOfPHP\Bard\Console\Command\MergeCommand; | ||
use SonsOfPHP\Bard\Console\Command\PullCommand; | ||
use SonsOfPHP\Bard\Console\Command\PushCommand; | ||
use SonsOfPHP\Bard\Console\Command\ReleaseCommand; | ||
use SonsOfPHP\Bard\Console\Command\SplitCommand; | ||
|
||
; | ||
use SonsOfPHP\Bard\Console\Command\UpdateCommand; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(Application::class)] | ||
#[UsesClass(AddCommand::class)] | ||
#[UsesClass(CopyCommand::class)] | ||
#[UsesClass(InitCommand::class)] | ||
#[UsesClass(InstallCommand::class)] | ||
#[UsesClass(MergeCommand::class)] | ||
#[UsesClass(PullCommand::class)] | ||
#[UsesClass(PushCommand::class)] | ||
#[UsesClass(ReleaseCommand::class)] | ||
#[UsesClass(SplitCommand::class)] | ||
#[UsesClass(UpdateCommand::class)] | ||
final class ApplicationTest extends TestCase | ||
{ | ||
private Application $application; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->application = new Application(); | ||
} | ||
|
||
public function testItsNameIsCorrect(): void | ||
{ | ||
$this->assertSame('Bard', $this->application->getName()); | ||
} | ||
|
||
public function testItHasAddCommand(): void | ||
{ | ||
$this->assertTrue($this->application->has('add')); | ||
} | ||
|
||
public function testItHasCopyCommand(): void | ||
{ | ||
$this->assertTrue($this->application->has('copy')); | ||
} | ||
|
||
public function testItHasInitCommand(): void | ||
{ | ||
$this->assertTrue($this->application->has('init')); | ||
} | ||
|
||
public function testItHasInstallCommand(): void | ||
{ | ||
$this->assertTrue($this->application->has('install')); | ||
} | ||
|
||
public function testItHasMergeCommand(): void | ||
{ | ||
$this->assertTrue($this->application->has('merge')); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/SonsOfPHP/Bard/Tests/Console/Command/AddCommandTest.php
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,67 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Console\Command; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\Console\Application; | ||
use SonsOfPHP\Bard\Console\Command\AbstractCommand; | ||
use SonsOfPHP\Bard\Console\Command\AddCommand; | ||
use SonsOfPHP\Bard\Console\Command\CopyCommand; | ||
use SonsOfPHP\Bard\Console\Command\InitCommand; | ||
use SonsOfPHP\Bard\Console\Command\InstallCommand; | ||
use SonsOfPHP\Bard\Console\Command\MergeCommand; | ||
use SonsOfPHP\Bard\Console\Command\PullCommand; | ||
use SonsOfPHP\Bard\Console\Command\PushCommand; | ||
use SonsOfPHP\Bard\Console\Command\ReleaseCommand; | ||
use SonsOfPHP\Bard\Console\Command\SplitCommand; | ||
use SonsOfPHP\Bard\Console\Command\UpdateCommand; | ||
use SonsOfPHP\Bard\JsonFile; | ||
use SonsOfPHP\Bard\Worker\File\Bard\AddPackageWorker; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(AddCommand::class)] | ||
#[UsesClass(Application::class)] | ||
#[UsesClass(AbstractCommand::class)] | ||
#[UsesClass(CopyCommand::class)] | ||
#[UsesClass(InitCommand::class)] | ||
#[UsesClass(InstallCommand::class)] | ||
#[UsesClass(MergeCommand::class)] | ||
#[UsesClass(PullCommand::class)] | ||
#[UsesClass(PushCommand::class)] | ||
#[UsesClass(ReleaseCommand::class)] | ||
#[UsesClass(SplitCommand::class)] | ||
#[UsesClass(UpdateCommand::class)] | ||
#[UsesClass(JsonFile::class)] | ||
#[UsesClass(AddPackageWorker::class)] | ||
final class AddCommandTest extends TestCase | ||
{ | ||
private Application $application; | ||
|
||
private AddCommand $command; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->application = new Application(); | ||
$this->command = $this->application->get('add'); | ||
} | ||
|
||
public function testItsNameIsCorrect(): void | ||
{ | ||
$commandTester = new CommandTester($this->command); | ||
|
||
$commandTester->execute([ | ||
'path' => 'tmp/repo', | ||
'repository' => 'git@repo:repo.git', | ||
'--dry-run' => true, | ||
'-vvv' => true, | ||
]); | ||
|
||
$commandTester->assertCommandIsSuccessful(); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/SonsOfPHP/Bard/Tests/Console/Command/CopyCommandTest.php
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,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Console\Command; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\Console\Application; | ||
use SonsOfPHP\Bard\Console\Command\AbstractCommand; | ||
use SonsOfPHP\Bard\Console\Command\AddCommand; | ||
use SonsOfPHP\Bard\Console\Command\CopyCommand; | ||
use SonsOfPHP\Bard\Console\Command\InitCommand; | ||
use SonsOfPHP\Bard\Console\Command\InstallCommand; | ||
use SonsOfPHP\Bard\Console\Command\MergeCommand; | ||
use SonsOfPHP\Bard\Console\Command\PullCommand; | ||
use SonsOfPHP\Bard\Console\Command\PushCommand; | ||
use SonsOfPHP\Bard\Console\Command\ReleaseCommand; | ||
use SonsOfPHP\Bard\Console\Command\SplitCommand; | ||
use SonsOfPHP\Bard\Console\Command\UpdateCommand; | ||
use SonsOfPHP\Bard\JsonFile; | ||
use SonsOfPHP\Bard\Worker\File\Bard\AddPackageWorker; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(CopyCommand::class)] | ||
#[UsesClass(Application::class)] | ||
#[UsesClass(AbstractCommand::class)] | ||
#[UsesClass(AddCommand::class)] | ||
#[UsesClass(InitCommand::class)] | ||
#[UsesClass(InstallCommand::class)] | ||
#[UsesClass(MergeCommand::class)] | ||
#[UsesClass(PullCommand::class)] | ||
#[UsesClass(PushCommand::class)] | ||
#[UsesClass(ReleaseCommand::class)] | ||
#[UsesClass(SplitCommand::class)] | ||
#[UsesClass(UpdateCommand::class)] | ||
#[UsesClass(JsonFile::class)] | ||
#[UsesClass(AddPackageWorker::class)] | ||
final class CopyCommandTest extends TestCase | ||
{ | ||
private Application $application; | ||
|
||
private CopyCommand $command; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->application = new Application(); | ||
$this->command = $this->application->get('copy'); | ||
} | ||
|
||
public function testItExecutesSuccessfully(): void | ||
{ | ||
$commandTester = new CommandTester($this->command); | ||
|
||
$commandTester->execute([ | ||
'source' => 'LICENSE', | ||
'--dry-run' => true, | ||
'-vvv' => true, | ||
]); | ||
|
||
$commandTester->assertCommandIsSuccessful(); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/SonsOfPHP/Bard/Tests/Console/Command/MergeCommandTest.php
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,85 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Console\Command; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\Console\Application; | ||
use SonsOfPHP\Bard\Console\Command\AbstractCommand; | ||
use SonsOfPHP\Bard\Console\Command\AddCommand; | ||
use SonsOfPHP\Bard\Console\Command\CopyCommand; | ||
use SonsOfPHP\Bard\Console\Command\InitCommand; | ||
use SonsOfPHP\Bard\Console\Command\InstallCommand; | ||
use SonsOfPHP\Bard\Console\Command\MergeCommand; | ||
use SonsOfPHP\Bard\Console\Command\PullCommand; | ||
use SonsOfPHP\Bard\Console\Command\PushCommand; | ||
use SonsOfPHP\Bard\Console\Command\ReleaseCommand; | ||
use SonsOfPHP\Bard\Console\Command\SplitCommand; | ||
use SonsOfPHP\Bard\Console\Command\UpdateCommand; | ||
use SonsOfPHP\Bard\JsonFile; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Package\Authors; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Package\BranchAlias; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Package\Funding; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Package\Support; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\ClearSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateAutoloadDevSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateAutoloadSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateProvideSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateReplaceSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateRequireDevSection; | ||
use SonsOfPHP\Bard\Worker\File\Composer\Root\UpdateRequireSection; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(MergeCommand::class)] | ||
#[UsesClass(Application::class)] | ||
#[UsesClass(AbstractCommand::class)] | ||
#[UsesClass(AddCommand::class)] | ||
#[UsesClass(CopyCommand::class)] | ||
#[UsesClass(InitCommand::class)] | ||
#[UsesClass(InstallCommand::class)] | ||
#[UsesClass(PullCommand::class)] | ||
#[UsesClass(PushCommand::class)] | ||
#[UsesClass(ReleaseCommand::class)] | ||
#[UsesClass(SplitCommand::class)] | ||
#[UsesClass(UpdateCommand::class)] | ||
#[UsesClass(JsonFile::class)] | ||
#[UsesClass(Authors::class)] | ||
#[UsesClass(BranchAlias::class)] | ||
#[UsesClass(Funding::class)] | ||
#[UsesClass(Support::class)] | ||
#[UsesClass(ClearSection::class)] | ||
#[UsesClass(UpdateAutoloadDevSection::class)] | ||
#[UsesClass(UpdateAutoloadSection::class)] | ||
#[UsesClass(UpdateProvideSection::class)] | ||
#[UsesClass(UpdateReplaceSection::class)] | ||
#[UsesClass(UpdateRequireSection::class)] | ||
#[UsesClass(UpdateRequireDevSection::class)] | ||
final class MergeCommandTest extends TestCase | ||
{ | ||
private Application $application; | ||
|
||
private MergeCommand $command; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->application = new Application(); | ||
$this->command = $this->application->get('merge'); | ||
} | ||
|
||
public function testItExecutesSuccessfully(): void | ||
{ | ||
$commandTester = new CommandTester($this->command); | ||
|
||
$commandTester->execute([ | ||
'--dry-run' => true, | ||
'-vvv' => true, | ||
]); | ||
|
||
$commandTester->assertCommandIsSuccessful(); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/SonsOfPHP/Bard/Tests/Console/Command/PushCommandTest.php
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Console\Command; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\Attributes\UsesClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\Console\Application; | ||
use SonsOfPHP\Bard\Console\Command\AbstractCommand; | ||
use SonsOfPHP\Bard\Console\Command\AddCommand; | ||
use SonsOfPHP\Bard\Console\Command\CopyCommand; | ||
use SonsOfPHP\Bard\Console\Command\InitCommand; | ||
use SonsOfPHP\Bard\Console\Command\InstallCommand; | ||
use SonsOfPHP\Bard\Console\Command\MergeCommand; | ||
use SonsOfPHP\Bard\Console\Command\PullCommand; | ||
use SonsOfPHP\Bard\Console\Command\PushCommand; | ||
use SonsOfPHP\Bard\Console\Command\ReleaseCommand; | ||
use SonsOfPHP\Bard\Console\Command\SplitCommand; | ||
use SonsOfPHP\Bard\Console\Command\UpdateCommand; | ||
use SonsOfPHP\Bard\JsonFile; | ||
use SonsOfPHP\Bard\Worker\File\Bard\AddPackageWorker; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(PushCommand::class)] | ||
#[UsesClass(Application::class)] | ||
#[UsesClass(AbstractCommand::class)] | ||
#[UsesClass(AddCommand::class)] | ||
#[UsesClass(CopyCommand::class)] | ||
#[UsesClass(InitCommand::class)] | ||
#[UsesClass(InstallCommand::class)] | ||
#[UsesClass(MergeCommand::class)] | ||
#[UsesClass(PullCommand::class)] | ||
#[UsesClass(ReleaseCommand::class)] | ||
#[UsesClass(SplitCommand::class)] | ||
#[UsesClass(UpdateCommand::class)] | ||
#[UsesClass(JsonFile::class)] | ||
#[UsesClass(AddPackageWorker::class)] | ||
final class PushCommandTest extends TestCase | ||
{ | ||
private Application $application; | ||
|
||
private PushCommand $command; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->application = new Application(); | ||
$this->command = $this->application->get('push'); | ||
} | ||
|
||
public function testItExecutesSuccessfully(): void | ||
{ | ||
$commandTester = new CommandTester($this->command); | ||
|
||
$commandTester->execute([ | ||
'--dry-run' => true, | ||
'-vvv' => true, | ||
]); | ||
|
||
$commandTester->assertCommandIsSuccessful(); | ||
} | ||
} |
Oops, something went wrong.