@@ -26,18 +26,18 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | final class ApplicationCatchingExceptionSupportTest extends TestCase |
| 28 | 28 | { |
| 29 | - public function test_it_can_show_the_list_of_the_available_commands(): void |
|
| 30 | - { |
|
| 31 | - $input = new StringInput('app:fail'); |
|
| 32 | - $output = new NullOutput(); |
|
| 29 | + public function test_it_can_show_the_list_of_the_available_commands(): void |
|
| 30 | + { |
|
| 31 | + $input = new StringInput('app:fail'); |
|
| 32 | + $output = new NullOutput(); |
|
| 33 | 33 | |
| 34 | - $this->expectException(UnexpectedValueException::class); |
|
| 35 | - $this->expectExceptionMessage('Fail'); |
|
| 34 | + $this->expectException(UnexpectedValueException::class); |
|
| 35 | + $this->expectExceptionMessage('Fail'); |
|
| 36 | 36 | |
| 37 | - ApplicationRunner::runApplication( |
|
| 38 | - new ApplicationThrowingException(), |
|
| 39 | - $input, |
|
| 40 | - $output, |
|
| 41 | - ); |
|
| 42 | - } |
|
| 37 | + ApplicationRunner::runApplication( |
|
| 38 | + new ApplicationThrowingException(), |
|
| 39 | + $input, |
|
| 40 | + $output, |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | * @covers \Fidry\Console\Application\ApplicationRunner |
| 25 | 25 | * @covers \Fidry\Console\Application\SymfonyApplication |
| 26 | 26 | */ |
| 27 | -final class ApplicationCatchingExceptionSupportTest extends TestCase |
|
| 28 | -{ |
|
| 27 | +final class ApplicationCatchingExceptionSupportTest extends TestCase { |
|
| 29 | 28 | public function test_it_can_show_the_list_of_the_available_commands(): void |
| 30 | 29 | { |
| 31 | 30 | $input = new StringInput('app:fail'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | final class BaseApplicationTest extends TestCase |
| 30 | 30 | { |
| 31 | - private const EXPECTED = <<<'EOT' |
|
| 31 | + private const EXPECTED = <<<'EOT' |
|
| 32 | 32 | BaseApp 1.0.0 |
| 33 | 33 | |
| 34 | 34 | Usage: |
@@ -52,53 +52,53 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | EOT; |
| 54 | 54 | |
| 55 | - public function test_it_can_be_run(): void |
|
| 56 | - { |
|
| 57 | - $input = new StringInput('list'); |
|
| 58 | - $output = new BufferedOutput(); |
|
| 59 | - |
|
| 60 | - ApplicationRunner::runApplication( |
|
| 61 | - new BaseApplication(), |
|
| 62 | - $input, |
|
| 63 | - $output, |
|
| 64 | - ); |
|
| 65 | - |
|
| 66 | - OutputAssertions::assertSameOutput( |
|
| 67 | - self::EXPECTED, |
|
| 68 | - $output->fetch(), |
|
| 69 | - ); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - public function test_it_can_be_run_without_the_static_helper(): void |
|
| 73 | - { |
|
| 74 | - $input = new StringInput('list'); |
|
| 75 | - $output = new BufferedOutput(); |
|
| 76 | - |
|
| 77 | - $runner = new ApplicationRunner(new BaseApplication()); |
|
| 78 | - |
|
| 79 | - $runner->run( |
|
| 80 | - new IO($input, $output), |
|
| 81 | - ); |
|
| 82 | - |
|
| 83 | - OutputAssertions::assertSameOutput( |
|
| 84 | - self::EXPECTED, |
|
| 85 | - $output->fetch(), |
|
| 86 | - ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function test_it_catches_exceptions_thrown(): void |
|
| 90 | - { |
|
| 91 | - $input = new StringInput('app:fail'); |
|
| 92 | - $output = new BufferedOutput(); |
|
| 93 | - |
|
| 94 | - ApplicationRunner::runApplication( |
|
| 95 | - new BaseApplication(), |
|
| 96 | - $input, |
|
| 97 | - $output, |
|
| 98 | - ); |
|
| 99 | - |
|
| 100 | - OutputAssertions::assertSameOutput( |
|
| 101 | - <<<'EOT' |
|
| 55 | + public function test_it_can_be_run(): void |
|
| 56 | + { |
|
| 57 | + $input = new StringInput('list'); |
|
| 58 | + $output = new BufferedOutput(); |
|
| 59 | + |
|
| 60 | + ApplicationRunner::runApplication( |
|
| 61 | + new BaseApplication(), |
|
| 62 | + $input, |
|
| 63 | + $output, |
|
| 64 | + ); |
|
| 65 | + |
|
| 66 | + OutputAssertions::assertSameOutput( |
|
| 67 | + self::EXPECTED, |
|
| 68 | + $output->fetch(), |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + public function test_it_can_be_run_without_the_static_helper(): void |
|
| 73 | + { |
|
| 74 | + $input = new StringInput('list'); |
|
| 75 | + $output = new BufferedOutput(); |
|
| 76 | + |
|
| 77 | + $runner = new ApplicationRunner(new BaseApplication()); |
|
| 78 | + |
|
| 79 | + $runner->run( |
|
| 80 | + new IO($input, $output), |
|
| 81 | + ); |
|
| 82 | + |
|
| 83 | + OutputAssertions::assertSameOutput( |
|
| 84 | + self::EXPECTED, |
|
| 85 | + $output->fetch(), |
|
| 86 | + ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public function test_it_catches_exceptions_thrown(): void |
|
| 90 | + { |
|
| 91 | + $input = new StringInput('app:fail'); |
|
| 92 | + $output = new BufferedOutput(); |
|
| 93 | + |
|
| 94 | + ApplicationRunner::runApplication( |
|
| 95 | + new BaseApplication(), |
|
| 96 | + $input, |
|
| 97 | + $output, |
|
| 98 | + ); |
|
| 99 | + |
|
| 100 | + OutputAssertions::assertSameOutput( |
|
| 101 | + <<<'EOT' |
|
| 102 | 102 | |
| 103 | 103 | In FailingCommand.php line 34: |
| 104 | 104 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | EOT, |
| 112 | - $output->fetch(), |
|
| 113 | - ); |
|
| 114 | - } |
|
| 112 | + $output->fetch(), |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | 115 | } |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | * @covers \Fidry\Console\Application\BaseApplication |
| 27 | 27 | * @covers \Fidry\Console\Application\SymfonyApplication |
| 28 | 28 | */ |
| 29 | -final class BaseApplicationTest extends TestCase |
|
| 30 | -{ |
|
| 29 | +final class BaseApplicationTest extends TestCase { |
|
| 31 | 30 | private const EXPECTED = <<<'EOT' |
| 32 | 31 | BaseApp 1.0.0 |
| 33 | 32 | |
@@ -28,47 +28,47 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | final class IOConfigurationSupportTest extends TestCase |
| 30 | 30 | { |
| 31 | - public function test_it_supports_application_which_configures_the_io(): void |
|
| 32 | - { |
|
| 33 | - $service = new StatefulService(); |
|
| 31 | + public function test_it_supports_application_which_configures_the_io(): void |
|
| 32 | + { |
|
| 33 | + $service = new StatefulService(); |
|
| 34 | 34 | |
| 35 | - // Sanity check |
|
| 36 | - self::assertFalse($service->called); |
|
| 35 | + // Sanity check |
|
| 36 | + self::assertFalse($service->called); |
|
| 37 | 37 | |
| 38 | - ApplicationRunner::runApplication( |
|
| 39 | - new ApplicationWithConfigurableIO($service), |
|
| 40 | - new StringInput('list'), |
|
| 41 | - new NullOutput(), |
|
| 42 | - ); |
|
| 38 | + ApplicationRunner::runApplication( |
|
| 39 | + new ApplicationWithConfigurableIO($service), |
|
| 40 | + new StringInput('list'), |
|
| 41 | + new NullOutput(), |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - /** @psalm-suppress DocblockTypeContradiction */ |
|
| 45 | - self::assertTrue($service->called); |
|
| 46 | - } |
|
| 44 | + /** @psalm-suppress DocblockTypeContradiction */ |
|
| 45 | + self::assertTrue($service->called); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @dataProvider applicationProvider |
|
| 50 | - */ |
|
| 51 | - public function test_it_uses_the_original_symfony_configuration(Application $application): void |
|
| 52 | - { |
|
| 53 | - unset($_ENV['SHELL_VERBOSITY']); |
|
| 48 | + /** |
|
| 49 | + * @dataProvider applicationProvider |
|
| 50 | + */ |
|
| 51 | + public function test_it_uses_the_original_symfony_configuration(Application $application): void |
|
| 52 | + { |
|
| 53 | + unset($_ENV['SHELL_VERBOSITY']); |
|
| 54 | 54 | |
| 55 | - ApplicationRunner::runApplication( |
|
| 56 | - $application, |
|
| 57 | - new StringInput('list'), |
|
| 58 | - new NullOutput(), |
|
| 59 | - ); |
|
| 55 | + ApplicationRunner::runApplication( |
|
| 56 | + $application, |
|
| 57 | + new StringInput('list'), |
|
| 58 | + new NullOutput(), |
|
| 59 | + ); |
|
| 60 | 60 | |
| 61 | - self::assertArrayHasKey('SHELL_VERBOSITY', $_ENV); |
|
| 62 | - } |
|
| 61 | + self::assertArrayHasKey('SHELL_VERBOSITY', $_ENV); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - public static function applicationProvider(): iterable |
|
| 65 | - { |
|
| 66 | - yield 'application with no configured IO' => [ |
|
| 67 | - new SimpleApplication(), |
|
| 68 | - ]; |
|
| 64 | + public static function applicationProvider(): iterable |
|
| 65 | + { |
|
| 66 | + yield 'application with no configured IO' => [ |
|
| 67 | + new SimpleApplication(), |
|
| 68 | + ]; |
|
| 69 | 69 | |
| 70 | - yield 'application with configured IO' => [ |
|
| 71 | - new ApplicationWithConfigurableIO(new StatefulService()), |
|
| 72 | - ]; |
|
| 73 | - } |
|
| 70 | + yield 'application with configured IO' => [ |
|
| 71 | + new ApplicationWithConfigurableIO(new StatefulService()), |
|
| 72 | + ]; |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | * @covers \Fidry\Console\Application\ApplicationRunner |
| 27 | 27 | * @covers \Fidry\Console\Application\SymfonyApplication |
| 28 | 28 | */ |
| 29 | -final class IOConfigurationSupportTest extends TestCase |
|
| 30 | -{ |
|
| 29 | +final class IOConfigurationSupportTest extends TestCase { |
|
| 31 | 30 | public function test_it_supports_application_which_configures_the_io(): void |
| 32 | 31 | { |
| 33 | 32 | $service = new StatefulService(); |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | final class ApplicationSimpleConfigSupportTest extends TestCase |
| 28 | 28 | { |
| 29 | - public function test_it_can_show_the_list_of_the_available_commands(): void |
|
| 30 | - { |
|
| 31 | - $input = new StringInput('list'); |
|
| 32 | - $output = new BufferedOutput(); |
|
| 33 | - |
|
| 34 | - ApplicationRunner::runApplication( |
|
| 35 | - new SimpleApplication(), |
|
| 36 | - $input, |
|
| 37 | - $output, |
|
| 38 | - ); |
|
| 39 | - |
|
| 40 | - $actual = $output->fetch(); |
|
| 41 | - $expected = <<<'EOT' |
|
| 29 | + public function test_it_can_show_the_list_of_the_available_commands(): void |
|
| 30 | + { |
|
| 31 | + $input = new StringInput('list'); |
|
| 32 | + $output = new BufferedOutput(); |
|
| 33 | + |
|
| 34 | + ApplicationRunner::runApplication( |
|
| 35 | + new SimpleApplication(), |
|
| 36 | + $input, |
|
| 37 | + $output, |
|
| 38 | + ); |
|
| 39 | + |
|
| 40 | + $actual = $output->fetch(); |
|
| 41 | + $expected = <<<'EOT' |
|
| 42 | 42 | help message |
| 43 | 43 | |
| 44 | 44 | Usage: |
@@ -61,50 +61,50 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | EOT; |
| 63 | 63 | |
| 64 | - OutputAssertions::assertSameOutput( |
|
| 65 | - $expected, |
|
| 66 | - $actual, |
|
| 67 | - ); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - public function test_it_executes_the_default_command_by_default(): void |
|
| 71 | - { |
|
| 72 | - $input = new StringInput(''); |
|
| 73 | - $output = new BufferedOutput(); |
|
| 74 | - |
|
| 75 | - ApplicationRunner::runApplication( |
|
| 76 | - new SimpleApplication(), |
|
| 77 | - $input, |
|
| 78 | - $output, |
|
| 79 | - ); |
|
| 80 | - |
|
| 81 | - $actual = $output->fetch(); |
|
| 82 | - OutputAssertions::assertSameOutput( |
|
| 83 | - '', |
|
| 84 | - $actual, |
|
| 85 | - ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - public function test_it_can_show_its_version(): void |
|
| 89 | - { |
|
| 90 | - $input = new StringInput('--version'); |
|
| 91 | - $output = new BufferedOutput(); |
|
| 92 | - |
|
| 93 | - ApplicationRunner::runApplication( |
|
| 94 | - new SimpleApplication(), |
|
| 95 | - $input, |
|
| 96 | - $output, |
|
| 97 | - ); |
|
| 98 | - |
|
| 99 | - $actual = $output->fetch(); |
|
| 100 | - $expected = <<<'EOT' |
|
| 64 | + OutputAssertions::assertSameOutput( |
|
| 65 | + $expected, |
|
| 66 | + $actual, |
|
| 67 | + ); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + public function test_it_executes_the_default_command_by_default(): void |
|
| 71 | + { |
|
| 72 | + $input = new StringInput(''); |
|
| 73 | + $output = new BufferedOutput(); |
|
| 74 | + |
|
| 75 | + ApplicationRunner::runApplication( |
|
| 76 | + new SimpleApplication(), |
|
| 77 | + $input, |
|
| 78 | + $output, |
|
| 79 | + ); |
|
| 80 | + |
|
| 81 | + $actual = $output->fetch(); |
|
| 82 | + OutputAssertions::assertSameOutput( |
|
| 83 | + '', |
|
| 84 | + $actual, |
|
| 85 | + ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + public function test_it_can_show_its_version(): void |
|
| 89 | + { |
|
| 90 | + $input = new StringInput('--version'); |
|
| 91 | + $output = new BufferedOutput(); |
|
| 92 | + |
|
| 93 | + ApplicationRunner::runApplication( |
|
| 94 | + new SimpleApplication(), |
|
| 95 | + $input, |
|
| 96 | + $output, |
|
| 97 | + ); |
|
| 98 | + |
|
| 99 | + $actual = $output->fetch(); |
|
| 100 | + $expected = <<<'EOT' |
|
| 101 | 101 | 1.0.0@60a94d3e |
| 102 | 102 | |
| 103 | 103 | EOT; |
| 104 | 104 | |
| 105 | - OutputAssertions::assertSameOutput( |
|
| 106 | - $expected, |
|
| 107 | - $actual, |
|
| 108 | - ); |
|
| 109 | - } |
|
| 105 | + OutputAssertions::assertSameOutput( |
|
| 106 | + $expected, |
|
| 107 | + $actual, |
|
| 108 | + ); |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | * @covers \Fidry\Console\Application\ApplicationRunner |
| 25 | 25 | * @covers \Fidry\Console\Application\SymfonyApplication |
| 26 | 26 | */ |
| 27 | -final class ApplicationSimpleConfigSupportTest extends TestCase |
|
| 28 | -{ |
|
| 27 | +final class ApplicationSimpleConfigSupportTest extends TestCase { |
|
| 29 | 28 | public function test_it_can_show_the_list_of_the_available_commands(): void |
| 30 | 29 | { |
| 31 | 30 | $input = new StringInput('list'); |
@@ -17,30 +17,30 @@ |
||
| 17 | 17 | |
| 18 | 18 | final class ApplicationThrowingException extends FidryBaseApplication |
| 19 | 19 | { |
| 20 | - public function getName(): string |
|
| 21 | - { |
|
| 22 | - return 'FailingApp'; |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public function getVersion(): string |
|
| 26 | - { |
|
| 27 | - return '1.0.0'; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function getCommands(): array |
|
| 31 | - { |
|
| 32 | - return [ |
|
| 33 | - new FailingCommand(), |
|
| 34 | - ]; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - public function isAutoExitEnabled(): bool |
|
| 38 | - { |
|
| 39 | - return false; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function areExceptionsCaught(): bool |
|
| 43 | - { |
|
| 44 | - return false; |
|
| 45 | - } |
|
| 20 | + public function getName(): string |
|
| 21 | + { |
|
| 22 | + return 'FailingApp'; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public function getVersion(): string |
|
| 26 | + { |
|
| 27 | + return '1.0.0'; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function getCommands(): array |
|
| 31 | + { |
|
| 32 | + return [ |
|
| 33 | + new FailingCommand(), |
|
| 34 | + ]; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + public function isAutoExitEnabled(): bool |
|
| 38 | + { |
|
| 39 | + return false; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function areExceptionsCaught(): bool |
|
| 43 | + { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -15,8 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | use Fidry\Console\Application\BaseApplication as FidryBaseApplication; |
| 17 | 17 | |
| 18 | -final class ApplicationThrowingException extends FidryBaseApplication |
|
| 19 | -{ |
|
| 18 | +final class ApplicationThrowingException extends FidryBaseApplication { |
|
| 20 | 19 | public function getName(): string |
| 21 | 20 | { |
| 22 | 21 | return 'FailingApp'; |
@@ -18,45 +18,45 @@ |
||
| 18 | 18 | |
| 19 | 19 | final class SimpleApplication implements Application |
| 20 | 20 | { |
| 21 | - public function getName(): string |
|
| 22 | - { |
|
| 23 | - return 'SimpleApp'; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function getVersion(): string |
|
| 27 | - { |
|
| 28 | - return '1.0.0'; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public function getLongVersion(): string |
|
| 32 | - { |
|
| 33 | - return '1.0.0@60a94d3e'; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function getCommands(): array |
|
| 37 | - { |
|
| 38 | - return [ |
|
| 39 | - new SimpleCommand(), |
|
| 40 | - ]; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function isAutoExitEnabled(): bool |
|
| 44 | - { |
|
| 45 | - return false; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function getHelp(): string |
|
| 49 | - { |
|
| 50 | - return 'help message'; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function getDefaultCommand(): string |
|
| 54 | - { |
|
| 55 | - return 'app:foo'; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - public function areExceptionsCaught(): bool |
|
| 59 | - { |
|
| 60 | - return true; |
|
| 61 | - } |
|
| 21 | + public function getName(): string |
|
| 22 | + { |
|
| 23 | + return 'SimpleApp'; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + public function getVersion(): string |
|
| 27 | + { |
|
| 28 | + return '1.0.0'; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + public function getLongVersion(): string |
|
| 32 | + { |
|
| 33 | + return '1.0.0@60a94d3e'; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + public function getCommands(): array |
|
| 37 | + { |
|
| 38 | + return [ |
|
| 39 | + new SimpleCommand(), |
|
| 40 | + ]; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function isAutoExitEnabled(): bool |
|
| 44 | + { |
|
| 45 | + return false; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function getHelp(): string |
|
| 49 | + { |
|
| 50 | + return 'help message'; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function getDefaultCommand(): string |
|
| 54 | + { |
|
| 55 | + return 'app:foo'; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + public function areExceptionsCaught(): bool |
|
| 59 | + { |
|
| 60 | + return true; |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | use Fidry\Console\Application\Application; |
| 17 | 17 | use Fidry\Console\Tests\Command\Fixture\SimpleCommand; |
| 18 | 18 | |
| 19 | -final class SimpleApplication implements Application |
|
| 20 | -{ |
|
| 19 | +final class SimpleApplication implements Application { |
|
| 21 | 20 | public function getName(): string |
| 22 | 21 | { |
| 23 | 22 | return 'SimpleApp'; |
@@ -18,26 +18,26 @@ |
||
| 18 | 18 | |
| 19 | 19 | final class BaseApplication extends FidryBaseApplication |
| 20 | 20 | { |
| 21 | - public function getName(): string |
|
| 22 | - { |
|
| 23 | - return 'BaseApp'; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function getVersion(): string |
|
| 27 | - { |
|
| 28 | - return '1.0.0'; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public function getCommands(): array |
|
| 32 | - { |
|
| 33 | - return [ |
|
| 34 | - new SimpleCommand(), |
|
| 35 | - new FailingCommand(), |
|
| 36 | - ]; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - public function isAutoExitEnabled(): bool |
|
| 40 | - { |
|
| 41 | - return false; |
|
| 42 | - } |
|
| 21 | + public function getName(): string |
|
| 22 | + { |
|
| 23 | + return 'BaseApp'; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + public function getVersion(): string |
|
| 27 | + { |
|
| 28 | + return '1.0.0'; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + public function getCommands(): array |
|
| 32 | + { |
|
| 33 | + return [ |
|
| 34 | + new SimpleCommand(), |
|
| 35 | + new FailingCommand(), |
|
| 36 | + ]; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + public function isAutoExitEnabled(): bool |
|
| 40 | + { |
|
| 41 | + return false; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | use Fidry\Console\Application\BaseApplication as FidryBaseApplication; |
| 17 | 17 | use Fidry\Console\Tests\Command\Fixture\SimpleCommand; |
| 18 | 18 | |
| 19 | -final class BaseApplication extends FidryBaseApplication |
|
| 20 | -{ |
|
| 19 | +final class BaseApplication extends FidryBaseApplication { |
|
| 21 | 20 | public function getName(): string |
| 22 | 21 | { |
| 23 | 22 | return 'BaseApp'; |
@@ -21,57 +21,57 @@ |
||
| 21 | 21 | |
| 22 | 22 | final class ApplicationWithConfigurableIO implements Application, ConfigurableIO |
| 23 | 23 | { |
| 24 | - private StatefulService $service; |
|
| 24 | + private StatefulService $service; |
|
| 25 | 25 | |
| 26 | - public function __construct(StatefulService $service) |
|
| 27 | - { |
|
| 28 | - $this->service = $service; |
|
| 29 | - } |
|
| 26 | + public function __construct(StatefulService $service) |
|
| 27 | + { |
|
| 28 | + $this->service = $service; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function getName(): string |
|
| 32 | - { |
|
| 33 | - return 'App'; |
|
| 34 | - } |
|
| 31 | + public function getName(): string |
|
| 32 | + { |
|
| 33 | + return 'App'; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function getVersion(): string |
|
| 37 | - { |
|
| 38 | - return '1.0.0'; |
|
| 39 | - } |
|
| 36 | + public function getVersion(): string |
|
| 37 | + { |
|
| 38 | + return '1.0.0'; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function getLongVersion(): string |
|
| 42 | - { |
|
| 43 | - return '1.0.0@60a94d3e'; |
|
| 44 | - } |
|
| 41 | + public function getLongVersion(): string |
|
| 42 | + { |
|
| 43 | + return '1.0.0@60a94d3e'; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function getCommands(): array |
|
| 47 | - { |
|
| 48 | - return [ |
|
| 49 | - new SimpleCommand(), |
|
| 50 | - ]; |
|
| 51 | - } |
|
| 46 | + public function getCommands(): array |
|
| 47 | + { |
|
| 48 | + return [ |
|
| 49 | + new SimpleCommand(), |
|
| 50 | + ]; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function isAutoExitEnabled(): bool |
|
| 54 | - { |
|
| 55 | - return false; |
|
| 56 | - } |
|
| 53 | + public function isAutoExitEnabled(): bool |
|
| 54 | + { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function getHelp(): string |
|
| 59 | - { |
|
| 60 | - return 'help message'; |
|
| 61 | - } |
|
| 58 | + public function getHelp(): string |
|
| 59 | + { |
|
| 60 | + return 'help message'; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function getDefaultCommand(): string |
|
| 64 | - { |
|
| 65 | - return 'app:foo'; |
|
| 66 | - } |
|
| 63 | + public function getDefaultCommand(): string |
|
| 64 | + { |
|
| 65 | + return 'app:foo'; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function areExceptionsCaught(): bool |
|
| 69 | - { |
|
| 70 | - return true; |
|
| 71 | - } |
|
| 68 | + public function areExceptionsCaught(): bool |
|
| 69 | + { |
|
| 70 | + return true; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - public function configureIO(IO $io): void |
|
| 74 | - { |
|
| 75 | - $this->service->call(); |
|
| 76 | - } |
|
| 73 | + public function configureIO(IO $io): void |
|
| 74 | + { |
|
| 75 | + $this->service->call(); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -20,17 +20,17 @@ |
||
| 20 | 20 | |
| 21 | 21 | final class FailingCommand implements Command |
| 22 | 22 | { |
| 23 | - public function getConfiguration(): Configuration |
|
| 24 | - { |
|
| 25 | - return new Configuration( |
|
| 26 | - 'app:fail', |
|
| 27 | - '', |
|
| 28 | - '', |
|
| 29 | - ); |
|
| 30 | - } |
|
| 23 | + public function getConfiguration(): Configuration |
|
| 24 | + { |
|
| 25 | + return new Configuration( |
|
| 26 | + 'app:fail', |
|
| 27 | + '', |
|
| 28 | + '', |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function execute(IO $io): int |
|
| 33 | - { |
|
| 34 | - throw new UnexpectedValueException('Fail'); |
|
| 35 | - } |
|
| 32 | + public function execute(IO $io): int |
|
| 33 | + { |
|
| 34 | + throw new UnexpectedValueException('Fail'); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | use Fidry\Console\IO; |
| 19 | 19 | use UnexpectedValueException; |
| 20 | 20 | |
| 21 | -final class FailingCommand implements Command |
|
| 22 | -{ |
|
| 21 | +final class FailingCommand implements Command { |
|
| 23 | 22 | public function getConfiguration(): Configuration |
| 24 | 23 | { |
| 25 | 24 | return new Configuration( |