-
-
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.
feat: Add support for using native Symfony commands (#201)
Closes #195.
- Loading branch information
Showing
8 changed files
with
106 additions
and
9 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
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
43 changes: 43 additions & 0 deletions
43
tests/Application/Feature/ApplicationSymfonyCommandsSupportTest.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,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry\Console package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\Console\Tests\Application\Feature; | ||
|
||
use Fidry\Console\Application\ApplicationRunner; | ||
use Fidry\Console\Tests\Application\Fixture\ApplicationWithSymfonyCommand; | ||
use Fidry\Console\Tests\Application\OutputAssertions; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Input\StringInput; | ||
use Symfony\Component\Console\Output\BufferedOutput; | ||
|
||
final class ApplicationSymfonyCommandsSupportTest extends TestCase | ||
{ | ||
public function test_it_can_execute_the_symfony_command(): void | ||
{ | ||
$input = new StringInput('symfony-cmd'); | ||
$output = new BufferedOutput(); | ||
|
||
ApplicationRunner::runApplication( | ||
new ApplicationWithSymfonyCommand(), | ||
$input, | ||
$output, | ||
); | ||
|
||
$actual = $output->fetch(); | ||
|
||
OutputAssertions::assertSameOutput( | ||
'', | ||
$actual, | ||
); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/Application/Fixture/ApplicationWithSymfonyCommand.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,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry\Console package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\Console\Tests\Application\Fixture; | ||
|
||
use Fidry\Console\Application\BaseApplication; | ||
use Fidry\Console\Tests\Command\Fixture\SimpleSymfonyCommand; | ||
|
||
final class ApplicationWithSymfonyCommand extends BaseApplication | ||
{ | ||
public function getCommands(): array | ||
{ | ||
return [ | ||
new SimpleSymfonyCommand(), | ||
]; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return 'ApplicationWithSymfonyCommand'; | ||
} | ||
|
||
public function getVersion(): string | ||
{ | ||
return '0.0'; | ||
} | ||
|
||
public function isAutoExitEnabled(): bool | ||
{ | ||
return 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