From 2c23369032e687af0920059335167c18b5877483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 3 Apr 2024 14:14:41 +0200 Subject: [PATCH 1/4] Fix Symfony Command on windows --- examples/symfony.php | 4 ++-- src/FunctionFinder.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/symfony.php b/examples/symfony.php index 3f4f7977..385675c9 100755 --- a/examples/symfony.php +++ b/examples/symfony.php @@ -15,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface; #[AsCommand('hello', 'Says hello from a symfony application')] -#[AsSymfonyTask(name: 'symfony:hello', console: [__FILE__])] +#[AsSymfonyTask(name: 'symfony:hello', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class HelloCommand extends Command { protected function execute(InputInterface $input, OutputInterface $output): int @@ -27,7 +27,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } #[AsCommand('greet')] -#[AsSymfonyTask(name: 'symfony:greet', console: [__FILE__])] +#[AsSymfonyTask(name: 'symfony:greet', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class GreetCommand extends Command { protected function configure(): void diff --git a/src/FunctionFinder.php b/src/FunctionFinder.php index b5b654b2..319220d6 100644 --- a/src/FunctionFinder.php +++ b/src/FunctionFinder.php @@ -169,7 +169,11 @@ private function resolveSymfonyTask(\ReflectionClass $reflectionClass): iterable $p = new Process([...$console, '--format=json']); $p->mustRun(); - return json_decode($p->getOutput(), true); + try { + return json_decode($p->getOutput(), true, 512, \JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \RuntimeException('Could not decode the Symfony console output.', 0, $e); + } }); $sfAttribute = $reflectionClass->getAttributes(AsCommand::class); From 8e418392b025877f32940c474d0192a6c7a71b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 3 Apr 2024 14:51:00 +0200 Subject: [PATCH 2/4] Disable PTY on windows --- CHANGELOG.md | 4 ++++ examples/run.php | 7 ++++++- src/FunctionFinder.php | 8 +++++++- src/functions.php | 15 +++++++++------ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 693f8a7b..5169e65d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ * Find root directory by looking for a `.castor/castor.php` file * Allow stub file to be in `.castor/.castor.stub.php` +* Fix issue with PTY on windows, it's now always disabled +* Fix issue when finding root dir on windows +* Fix issue on SymfonyTask creation + * Deprecate loading all PHP files from `[ROOT_DIR]/castor` * Deprecate `Context::withPath()` in favor of `Context::withWorkingDirectory()` * Deprecate `path` argument in `capture()`, `exit_code()`, `run()`, `with()` in diff --git a/examples/run.php b/examples/run.php index 9e6e3cfc..1cde49a0 100644 --- a/examples/run.php +++ b/examples/run.php @@ -3,6 +3,7 @@ namespace run; use Castor\Attribute\AsTask; +use JoliCode\PhpOsHelper\OsHelper; use Symfony\Component\Console\Helper\ProcessHelper; use function Castor\app; @@ -15,7 +16,11 @@ #[AsTask(description: 'Run a sub-process and display information about it')] function ls(): void { - $process = run('ls -alh && echo $foo', quiet: true, environment: ['foo' => 'ba\'"`r']); + if (OsHelper::isWindows()) { + $process = run('dir'); + } else { + $process = run('ls -alh && echo $foo', quiet: true, environment: ['foo' => 'ba\'"`r']); + } io()->writeln('Output:' . $process->getOutput()); io()->writeln('Error output: ' . $process->getErrorOutput()); diff --git a/src/FunctionFinder.php b/src/FunctionFinder.php index 319220d6..8a98c557 100644 --- a/src/FunctionFinder.php +++ b/src/FunctionFinder.php @@ -16,6 +16,7 @@ use Castor\Helper\SluggerHelper; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Finder\Finder; +use Symfony\Component\Process\Exception\ExceptionInterface; use Symfony\Component\Process\Process; use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\ItemInterface; @@ -167,7 +168,12 @@ private function resolveSymfonyTask(\ReflectionClass $reflectionClass): iterable $definitions = $this->cache->get($key, function (ItemInterface $item) use ($console) { $item->expiresAfter(60 * 60 * 24); $p = new Process([...$console, '--format=json']); - $p->mustRun(); + + try { + $p->mustRun(); + } catch (ExceptionInterface $e) { + throw new FunctionConfigurationException('Could not run the Symfony console.', $reflectionClass, $e); + } try { return json_decode($p->getOutput(), true, 512, \JSON_THROW_ON_ERROR); diff --git a/src/functions.php b/src/functions.php index 8367bd0b..cd97bd41 100644 --- a/src/functions.php +++ b/src/functions.php @@ -128,12 +128,15 @@ function run( ; } - if ($context->tty) { - $process->setTty(true); - $process->setInput(\STDIN); - } elseif ($context->pty) { - $process->setPty(true); - $process->setInput(\STDIN); + // TTY does not work on windows, and PTY is a mess, so let's skip everything! + if (!OsHelper::isWindows()) { + if ($context->tty) { + $process->setTty(true); + $process->setInput(\STDIN); + } elseif ($context->pty) { + $process->setPty(true); + $process->setInput(\STDIN); + } } if (!$context->quiet && !$callback) { From 4bae84bbf8d97672bae02d2d6e93380603d338cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 3 Apr 2024 16:17:11 +0200 Subject: [PATCH 3/4] Disable symfony task in static binary --- bin/generate-tests.php | 20 +++++++++++++-- examples/symfony.php | 4 +-- src/FunctionFinder.php | 9 +++++-- tests/Examples/Generated/ListTest.php | 4 +++ tests/Examples/Generated/SymfonyGreetTest.php | 6 ++++- .../Generated/SymfonyGreetTest.php.output.txt | 2 +- tests/Examples/Generated/SymfonyHelloTest.php | 4 +++ tests/Examples/ListOnStaticBinTest.php | 25 +++++++++++++++++++ tests/Helper/OutputCleaner.php | 2 ++ tests/TaskTestCase.php | 12 ++++++--- 10 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 tests/Examples/ListOnStaticBinTest.php diff --git a/bin/generate-tests.php b/bin/generate-tests.php index e24bff42..bf4831dc 100755 --- a/bin/generate-tests.php +++ b/bin/generate-tests.php @@ -80,10 +80,13 @@ 'log:error', 'log:info', 'log:with-context', + 'list', 'parallel:sleep', 'remote-import:remote-tasks', 'run:ls', 'run:run-parallel', + 'symfony:greet', + 'symfony:hello', // Imported tasks 'pyrech:hello-example', 'pyrech:foobar', @@ -140,7 +143,10 @@ add_test(['context:context', '--context', 'production'], 'ContextContextProductionTest'); add_test(['context:context', '--context', 'run'], 'ContextContextRunTest'); add_test(['enabled:hello', '--context', 'production'], 'EnabledInProduction'); +add_test(['list', '--raw', '--format', 'txt', '--short'], 'ListTest', skipOnBinary: true); add_test(['parallel:sleep', '--sleep5', '0', '--sleep7', '0', '--sleep10', '0'], 'ParallelSleepTest'); +add_test(['symfony:greet', 'World', '--french', 'COUCOU', '--punctuation', '!' ], 'SymfonyGreetTest', skipOnBinary: true); +add_test(['symfony:hello'], 'SymfonyHelloTest', skipOnBinary: true); // In /tmp add_test(['completion', 'bash'], 'NoConfigCompletionTest', '/tmp'); add_test(['init'], 'NewProjectInitTest', '/tmp'); @@ -150,7 +156,7 @@ add_test(['list'], 'LayoutWithFolder', __DIR__ . '/../tests/Examples/fixtures/layout/with-folder'); add_test(['list'], 'LayoutWithOldFolder', __DIR__ . '/../tests/Examples/fixtures/layout/with-old-folder'); -function add_test(array $args, string $class, ?string $cwd = null, bool $needRemote = false) +function add_test(array $args, string $class, ?string $cwd = null, bool $needRemote = false, bool $skipOnBinary = false) { $fp = fopen(__FILE__, 'r'); fseek($fp, __COMPILER_HALT_OFFSET__ + 1); @@ -175,6 +181,16 @@ function add_test(array $args, string $class, ?string $cwd = null, bool $needRem '{{ exitCode }}' => $process->getExitCode(), '{{ cwd }}' => $cwd ? ', ' . var_export($cwd, true) : '', '{{ needRemote }}' => $needRemote ? ', needRemote: true' : '', + '{{ skip-on-binary }}' => match ($skipOnBinary) { + true => <<<'PHP' + + if (self::$binary) { + $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); + } + + PHP, + default => '', + }, ]); file_put_contents(__DIR__ . '/../tests/Examples/Generated/' . $class . '.php', $code); @@ -196,7 +212,7 @@ class {{ class_name }} extends TaskTestCase { // {{ task }} public function test(): void - { + {{{ skip-on-binary }} $process = $this->runTask([{{ args }}]{{ cwd }}{{ needRemote }}); $this->assertSame({{ exitCode }}, $process->getExitCode()); diff --git a/examples/symfony.php b/examples/symfony.php index 385675c9..9cac474b 100755 --- a/examples/symfony.php +++ b/examples/symfony.php @@ -15,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface; #[AsCommand('hello', 'Says hello from a symfony application')] -#[AsSymfonyTask(name: 'symfony:hello', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows +#[AsSymfonyTask(name: 'symfony:hello', console: [PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class HelloCommand extends Command { protected function execute(InputInterface $input, OutputInterface $output): int @@ -27,7 +27,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } #[AsCommand('greet')] -#[AsSymfonyTask(name: 'symfony:greet', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows +#[AsSymfonyTask(name: 'symfony:greet', console: [PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class GreetCommand extends Command { protected function configure(): void diff --git a/src/FunctionFinder.php b/src/FunctionFinder.php index 8a98c557..b62fff11 100644 --- a/src/FunctionFinder.php +++ b/src/FunctionFinder.php @@ -105,6 +105,10 @@ private function doFindFunctions(string $file): iterable if (class_exists(\RepackedApplication::class)) { return; } + // Nor in static binary + if (!\PHP_BINARY) { + return; + } $newClasses = array_diff(get_declared_classes(), $initialClasses); foreach ($newClasses as $className) { @@ -165,8 +169,9 @@ private function resolveSymfonyTask(\ReflectionClass $reflectionClass): iterable $key = hash('sha256', implode('-', ['symfony-console-definitions-', ...$console, $this->rootDir])); - $definitions = $this->cache->get($key, function (ItemInterface $item) use ($console) { + $definitions = $this->cache->get($key, function (ItemInterface $item) use ($console, $reflectionClass) { $item->expiresAfter(60 * 60 * 24); + $p = new Process([...$console, '--format=json']); try { @@ -178,7 +183,7 @@ private function resolveSymfonyTask(\ReflectionClass $reflectionClass): iterable try { return json_decode($p->getOutput(), true, 512, \JSON_THROW_ON_ERROR); } catch (\JsonException $e) { - throw new \RuntimeException('Could not decode the Symfony console output.', 0, $e); + throw new FunctionConfigurationException('Could not run the Symfony console.', $reflectionClass, $e); } }); diff --git a/tests/Examples/Generated/ListTest.php b/tests/Examples/Generated/ListTest.php index 41ca18d3..637797af 100644 --- a/tests/Examples/Generated/ListTest.php +++ b/tests/Examples/Generated/ListTest.php @@ -9,6 +9,10 @@ class ListTest extends TaskTestCase // list public function test(): void { + if (self::$binary) { + $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); + } + $process = $this->runTask(['list', '--raw', '--format', 'txt', '--short']); $this->assertSame(0, $process->getExitCode()); diff --git a/tests/Examples/Generated/SymfonyGreetTest.php b/tests/Examples/Generated/SymfonyGreetTest.php index f1a5f137..80c247c5 100644 --- a/tests/Examples/Generated/SymfonyGreetTest.php +++ b/tests/Examples/Generated/SymfonyGreetTest.php @@ -9,7 +9,11 @@ class SymfonyGreetTest extends TaskTestCase // symfony:greet public function test(): void { - $process = $this->runTask(['symfony:greet', 'FIXME(who)', '--french', 'FIXME', '--punctuation', '!']); + if (self::$binary) { + $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); + } + + $process = $this->runTask(['symfony:greet', 'World', '--french', 'COUCOU', '--punctuation', '!']); $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/SymfonyGreetTest.php.output.txt b/tests/Examples/Generated/SymfonyGreetTest.php.output.txt index 33455117..ea71fb2f 100644 --- a/tests/Examples/Generated/SymfonyGreetTest.php.output.txt +++ b/tests/Examples/Generated/SymfonyGreetTest.php.output.txt @@ -1 +1 @@ -Salut FIXME(who)! FIXME +Salut World! COUCOU diff --git a/tests/Examples/Generated/SymfonyHelloTest.php b/tests/Examples/Generated/SymfonyHelloTest.php index 703f1894..81a2d60a 100644 --- a/tests/Examples/Generated/SymfonyHelloTest.php +++ b/tests/Examples/Generated/SymfonyHelloTest.php @@ -9,6 +9,10 @@ class SymfonyHelloTest extends TaskTestCase // symfony:hello public function test(): void { + if (self::$binary) { + $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); + } + $process = $this->runTask(['symfony:hello']); $this->assertSame(0, $process->getExitCode()); diff --git a/tests/Examples/ListOnStaticBinTest.php b/tests/Examples/ListOnStaticBinTest.php new file mode 100644 index 00000000..777ec64d --- /dev/null +++ b/tests/Examples/ListOnStaticBinTest.php @@ -0,0 +1,25 @@ +markTestSkipped('This test for the binary version of Castor.'); + } + + $process = $this->runTask(['list', '--raw', '--format', 'txt', '--short']); + + $this->assertSame(0, $process->getExitCode()); + $expected = file_get_contents(__DIR__ . '/Generated/ListTest.php.output.txt'); + $expected = preg_replace('{^(symfony\:.*\n)}m', '', $expected); + $this->assertSame($expected, OutputCleaner::cleanOutput($process->getOutput())); + $this->assertSame('', $process->getErrorOutput()); + } +} diff --git a/tests/Helper/OutputCleaner.php b/tests/Helper/OutputCleaner.php index 6ee7bdde..70ae226d 100644 --- a/tests/Helper/OutputCleaner.php +++ b/tests/Helper/OutputCleaner.php @@ -10,6 +10,8 @@ public static function cleanOutput(string $string): string // In the bash completion script ×2 $string = str_replace('_sf_castor.linux-amd64.phar', '_sf_castor', $string); $string = str_replace('castor.linux-amd64.phar', 'castor', $string); + $string = str_replace('_sf_castor.linux-amd64', '_sf_castor', $string); + $string = str_replace('castor.linux-amd64', 'castor', $string); $string = preg_replace('{In ([A-Z]\w+).php line \d+:}m', 'In \1.php line XXXX:', $string); $string = preg_replace('{In functions.php line \d+:}m', 'In functions.php line XXXX:', $string); $string = preg_replace('{you are using v\d+.\d+.\d+.}m', 'you are using vX.Y.Z.', $string); diff --git a/tests/TaskTestCase.php b/tests/TaskTestCase.php index e38bae09..8d96f684 100644 --- a/tests/TaskTestCase.php +++ b/tests/TaskTestCase.php @@ -9,17 +9,21 @@ abstract class TaskTestCase extends TestCase { + static string $castorBin; + static bool $binary = false; + public static function setUpBeforeClass(): void { WebServerHelper::start(); + + self::$castorBin = $_SERVER['CASTOR_BIN'] ?? __DIR__ . '/../bin/castor'; + self::$binary = 'application/x-executable' === mime_content_type(self::$castorBin); } public function runTask(array $args, ?string $cwd = null, bool $needRemote = false): Process { $coverage = $this->getTestResultObject()?->getCodeCoverage(); - $castorBin = $_SERVER['CASTOR_BIN'] ?? __DIR__ . '/../bin/castor'; - $extraEnv = [ 'ENDPOINT' => $_SERVER['ENDPOINT'], ]; @@ -29,7 +33,7 @@ public function runTask(array $args, ?string $cwd = null, bool $needRemote = fal } if ($coverage) { - $castorBin = __DIR__ . '/bin/castor'; + self::$castorBin = __DIR__ . '/bin/castor'; $testName = debug_backtrace()[1]['class'] . '::' . debug_backtrace()[1]['function']; $outputFilename = stream_get_meta_data(tmpfile())['uri']; $extraEnv['CC_OUTPUT_FILENAME'] = $outputFilename; @@ -37,7 +41,7 @@ public function runTask(array $args, ?string $cwd = null, bool $needRemote = fal } $process = new Process( - [$castorBin, '--no-ansi', ...$args], + [self::$castorBin, '--no-ansi', ...$args], cwd: $cwd ? str_replace('{{ base }}', __DIR__ . '/..', $cwd) : __DIR__ . '/..', env: [ 'COLUMNS' => 1000, From 45424c4f66469c9b4b731e2e6ca2f69cea9cc1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 3 Apr 2024 16:23:28 +0200 Subject: [PATCH 4/4] chore: Simplify generated tests --- bin/generate-tests.php | 27 +++++++++++-------- examples/symfony.php | 4 +-- .../Generated/ArgPassthruExpanded.php | 6 +---- .../Generated/ArgsAnotherArgsTest.php | 6 +---- tests/Examples/Generated/ArgsArgsTest.php | 6 +---- .../ArgsAutocompleteArgumentTest.php | 6 +---- tests/Examples/Generated/ArgsPassthruTest.php | 6 +---- .../Generated/AutocompleteInvalidTest.php | 6 +---- tests/Examples/Generated/BarBarTest.php | 6 +---- tests/Examples/Generated/CacheComplexTest.php | 6 +---- tests/Examples/Generated/CacheSimpleTest.php | 6 +---- tests/Examples/Generated/CdDirectoryTest.php | 6 +---- .../ContextContextDoNotExistTest.php | 6 +---- .../Generated/ContextContextDynamicTest.php | 6 +---- .../ContextContextInfoForcedTest.php | 6 +---- .../Generated/ContextContextMyDefaultTest.php | 6 +---- .../Generated/ContextContextPathTest.php | 6 +---- .../ContextContextProductionTest.php | 6 +---- .../Generated/ContextContextRunTest.php | 6 +---- .../Examples/Generated/ContextContextTest.php | 6 +---- .../Generated/ContextContextWithTest.php | 6 +---- .../Generated/ContextGeneratorArg2Test.php | 6 +---- .../Generated/ContextGeneratorArgTest.php | 6 +---- .../ContextGeneratorNotCallableTest.php | 6 +---- .../Generated/EnabledInProduction.php | 6 +---- tests/Examples/Generated/EnvEnvTest.php | 6 +---- .../Generated/EventListenerMyTaskTest.php | 6 +---- .../Generated/FailureAllowFailureTest.php | 6 +---- .../Examples/Generated/FailureFailureTest.php | 6 +---- .../Generated/FilesystemFilesystemTest.php | 6 +---- .../Examples/Generated/FilesystemFindTest.php | 6 +---- tests/Examples/Generated/FooBarTest.php | 6 +---- tests/Examples/Generated/FooFooTest.php | 6 +---- tests/Examples/Generated/HelloTest.php | 6 +---- tests/Examples/Generated/HttpRequestTest.php | 6 +---- .../Generated/ImportComposerSourceTest.php | 6 +---- .../Generated/ImportFileNotExistTest.php | 6 +---- .../Generated/ImportInvalidFormatTest.php | 6 +---- .../Generated/ImportInvalidImportTest.php | 6 +---- .../Generated/ImportInvalidPackageTest.php | 6 +---- .../ImportSamePackageDifferentVersionTest.php | 6 +---- tests/Examples/Generated/LayoutWithFolder.php | 6 +---- .../Generated/LayoutWithOldFolder.php | 6 +---- tests/Examples/Generated/ListTest.php | 6 +---- .../Examples/Generated/NewProjectInitTest.php | 6 +---- tests/Examples/Generated/NewProjectTest.php | 6 +---- .../Generated/NoConfigCompletionTest.php | 6 +---- .../Generated/NoConfigUnknownTest.php | 6 +---- .../Generated/NoConfigUnknownWithArgsTest.php | 6 +---- .../Generated/NoDefaultContextTest.php | 6 +---- tests/Examples/Generated/NoNamespaceTest.php | 6 +---- .../Generated/NotRenameRenamedTest.php | 6 +---- .../Generated/NotifyNotifyOnFinishTest.php | 6 +---- .../Generated/NotifySendNotifyTest.php | 6 +---- tests/Examples/Generated/OutputOutputTest.php | 6 +---- .../Generated/ParallelExceptionTest.php | 6 +---- .../Examples/Generated/ParallelSleepTest.php | 6 +---- tests/Examples/Generated/QuietQuietTest.php | 6 +---- tests/Examples/Generated/RunTestFileTest.php | 6 +---- tests/Examples/Generated/RunVariablesTest.php | 6 +---- tests/Examples/Generated/RunWhoamiTest.php | 6 +---- .../Generated/RunWithProcessHelperTest.php | 6 +---- tests/Examples/Generated/ShellBashTest.php | 6 +---- tests/Examples/Generated/ShellShTest.php | 6 +---- .../Examples/Generated/SignalSigusr2Test.php | 6 +---- tests/Examples/Generated/SymfonyGreetTest.php | 6 +---- tests/Examples/Generated/SymfonyHelloTest.php | 6 +---- .../Generated/TwoDefaultContextTest.php | 6 +---- .../VersionGuardMinVersionCheckFailTest.php | 6 +---- .../VersionGuardMinVersionCheckTest.php | 6 +---- .../WaitForCustomWaitForTaskTest.php | 6 +---- .../WaitForWaitForDockerContainerTaskTest.php | 6 +---- .../Generated/WaitForWaitForPortTaskTest.php | 6 +---- .../Generated/WaitForWaitForUrlTaskTest.php | 6 +---- ...thSpecificResponseContentAndStatusTest.php | 6 +---- ...aitForWaitForUrlWithStatusCodeOnlyTest.php | 6 +---- tests/Examples/Generated/YamlDumpTest.php | 6 +---- tests/Examples/Generated/YamlParseTest.php | 6 +---- tests/Examples/ListOnStaticBinTest.php | 2 +- tests/TaskTestCase.php | 4 +-- 80 files changed, 97 insertions(+), 396 deletions(-) diff --git a/bin/generate-tests.php b/bin/generate-tests.php index bf4831dc..7bc291ef 100755 --- a/bin/generate-tests.php +++ b/bin/generate-tests.php @@ -145,7 +145,7 @@ add_test(['enabled:hello', '--context', 'production'], 'EnabledInProduction'); add_test(['list', '--raw', '--format', 'txt', '--short'], 'ListTest', skipOnBinary: true); add_test(['parallel:sleep', '--sleep5', '0', '--sleep7', '0', '--sleep10', '0'], 'ParallelSleepTest'); -add_test(['symfony:greet', 'World', '--french', 'COUCOU', '--punctuation', '!' ], 'SymfonyGreetTest', skipOnBinary: true); +add_test(['symfony:greet', 'World', '--french', 'COUCOU', '--punctuation', '!'], 'SymfonyGreetTest', skipOnBinary: true); add_test(['symfony:hello'], 'SymfonyHelloTest', skipOnBinary: true); // In /tmp add_test(['completion', 'bash'], 'NoConfigCompletionTest', '/tmp'); @@ -174,6 +174,8 @@ function add_test(array $args, string $class, ?string $cwd = null, bool $needRem ); $process->run(); + $err = OutputCleaner::cleanOutput($process->getErrorOutput()); + $code = strtr($template, [ '{{ class_name }}' => $class, '{{ task }}' => $args[0] ?? 'no task', @@ -184,18 +186,25 @@ function add_test(array $args, string $class, ?string $cwd = null, bool $needRem '{{ skip-on-binary }}' => match ($skipOnBinary) { true => <<<'PHP' - if (self::$binary) { - $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); - } + if (self::$binary) { + $this->markTestSkipped('This test is not compatible with the binary version of Castor.'); + } - PHP, + PHP, default => '', }, + '{{ error-assertion }}' => match ((bool) $err) { + true => <<<'PHP' + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); + PHP, + default => <<<'PHP' + $this->assertSame('', $process->getErrorOutput()); + PHP, + }, ]); file_put_contents(__DIR__ . '/../tests/Examples/Generated/' . $class . '.php', $code); file_put_contents(__DIR__ . '/../tests/Examples/Generated/' . $class . '.php.output.txt', OutputCleaner::cleanOutput($process->getOutput())); - $err = OutputCleaner::cleanOutput($process->getErrorOutput()); if ($err) { file_put_contents(__DIR__ . '/../tests/Examples/Generated/' . $class . '.php.err.txt', $err); } @@ -217,10 +226,6 @@ public function test(): void $this->assertSame({{ exitCode }}, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + {{ error-assertion }} } } diff --git a/examples/symfony.php b/examples/symfony.php index 9cac474b..385675c9 100755 --- a/examples/symfony.php +++ b/examples/symfony.php @@ -15,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface; #[AsCommand('hello', 'Says hello from a symfony application')] -#[AsSymfonyTask(name: 'symfony:hello', console: [PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows +#[AsSymfonyTask(name: 'symfony:hello', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class HelloCommand extends Command { protected function execute(InputInterface $input, OutputInterface $output): int @@ -27,7 +27,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } #[AsCommand('greet')] -#[AsSymfonyTask(name: 'symfony:greet', console: [PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows +#[AsSymfonyTask(name: 'symfony:greet', console: [\PHP_BINARY, __FILE__])] // We need to force PHP binary to support windows class GreetCommand extends Command { protected function configure(): void diff --git a/tests/Examples/Generated/ArgPassthruExpanded.php b/tests/Examples/Generated/ArgPassthruExpanded.php index 05f989f2..6c82d9cf 100644 --- a/tests/Examples/Generated/ArgPassthruExpanded.php +++ b/tests/Examples/Generated/ArgPassthruExpanded.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ArgsAnotherArgsTest.php b/tests/Examples/Generated/ArgsAnotherArgsTest.php index bae04fdb..243f67a2 100644 --- a/tests/Examples/Generated/ArgsAnotherArgsTest.php +++ b/tests/Examples/Generated/ArgsAnotherArgsTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ArgsArgsTest.php b/tests/Examples/Generated/ArgsArgsTest.php index 9c14a65a..48438bb9 100644 --- a/tests/Examples/Generated/ArgsArgsTest.php +++ b/tests/Examples/Generated/ArgsArgsTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ArgsAutocompleteArgumentTest.php b/tests/Examples/Generated/ArgsAutocompleteArgumentTest.php index b2b600ee..99c78edd 100644 --- a/tests/Examples/Generated/ArgsAutocompleteArgumentTest.php +++ b/tests/Examples/Generated/ArgsAutocompleteArgumentTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ArgsPassthruTest.php b/tests/Examples/Generated/ArgsPassthruTest.php index 3f6b2d02..61dab182 100644 --- a/tests/Examples/Generated/ArgsPassthruTest.php +++ b/tests/Examples/Generated/ArgsPassthruTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/AutocompleteInvalidTest.php b/tests/Examples/Generated/AutocompleteInvalidTest.php index 2531c1e2..8aecf7ce 100644 --- a/tests/Examples/Generated/AutocompleteInvalidTest.php +++ b/tests/Examples/Generated/AutocompleteInvalidTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/BarBarTest.php b/tests/Examples/Generated/BarBarTest.php index 193873c2..4710d81e 100644 --- a/tests/Examples/Generated/BarBarTest.php +++ b/tests/Examples/Generated/BarBarTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/CacheComplexTest.php b/tests/Examples/Generated/CacheComplexTest.php index 9e053624..af4c84e3 100644 --- a/tests/Examples/Generated/CacheComplexTest.php +++ b/tests/Examples/Generated/CacheComplexTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/CacheSimpleTest.php b/tests/Examples/Generated/CacheSimpleTest.php index e25b9d37..c8860a89 100644 --- a/tests/Examples/Generated/CacheSimpleTest.php +++ b/tests/Examples/Generated/CacheSimpleTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/CdDirectoryTest.php b/tests/Examples/Generated/CdDirectoryTest.php index adcd1930..167ec515 100644 --- a/tests/Examples/Generated/CdDirectoryTest.php +++ b/tests/Examples/Generated/CdDirectoryTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextDoNotExistTest.php b/tests/Examples/Generated/ContextContextDoNotExistTest.php index fc453d44..abb00fcb 100644 --- a/tests/Examples/Generated/ContextContextDoNotExistTest.php +++ b/tests/Examples/Generated/ContextContextDoNotExistTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextDynamicTest.php b/tests/Examples/Generated/ContextContextDynamicTest.php index c144abcc..693dd76f 100644 --- a/tests/Examples/Generated/ContextContextDynamicTest.php +++ b/tests/Examples/Generated/ContextContextDynamicTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextInfoForcedTest.php b/tests/Examples/Generated/ContextContextInfoForcedTest.php index e3a963a9..9ae04421 100644 --- a/tests/Examples/Generated/ContextContextInfoForcedTest.php +++ b/tests/Examples/Generated/ContextContextInfoForcedTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextMyDefaultTest.php b/tests/Examples/Generated/ContextContextMyDefaultTest.php index 5a5be547..eb99cbd2 100644 --- a/tests/Examples/Generated/ContextContextMyDefaultTest.php +++ b/tests/Examples/Generated/ContextContextMyDefaultTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextPathTest.php b/tests/Examples/Generated/ContextContextPathTest.php index 21536ec6..ffeb72a9 100644 --- a/tests/Examples/Generated/ContextContextPathTest.php +++ b/tests/Examples/Generated/ContextContextPathTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextProductionTest.php b/tests/Examples/Generated/ContextContextProductionTest.php index e795e668..39ae1c33 100644 --- a/tests/Examples/Generated/ContextContextProductionTest.php +++ b/tests/Examples/Generated/ContextContextProductionTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextRunTest.php b/tests/Examples/Generated/ContextContextRunTest.php index 5cb7286b..5100ec00 100644 --- a/tests/Examples/Generated/ContextContextRunTest.php +++ b/tests/Examples/Generated/ContextContextRunTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextTest.php b/tests/Examples/Generated/ContextContextTest.php index 2cb5749a..7ec2e86b 100644 --- a/tests/Examples/Generated/ContextContextTest.php +++ b/tests/Examples/Generated/ContextContextTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextContextWithTest.php b/tests/Examples/Generated/ContextContextWithTest.php index 9deab6e1..f94a2973 100644 --- a/tests/Examples/Generated/ContextContextWithTest.php +++ b/tests/Examples/Generated/ContextContextWithTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextGeneratorArg2Test.php b/tests/Examples/Generated/ContextGeneratorArg2Test.php index bbf112be..22534e78 100644 --- a/tests/Examples/Generated/ContextGeneratorArg2Test.php +++ b/tests/Examples/Generated/ContextGeneratorArg2Test.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextGeneratorArgTest.php b/tests/Examples/Generated/ContextGeneratorArgTest.php index 965066a2..416dba4a 100644 --- a/tests/Examples/Generated/ContextGeneratorArgTest.php +++ b/tests/Examples/Generated/ContextGeneratorArgTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php index 22fc735c..c24b5ddb 100644 --- a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php +++ b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/EnabledInProduction.php b/tests/Examples/Generated/EnabledInProduction.php index e26f6bb4..cd484b3a 100644 --- a/tests/Examples/Generated/EnabledInProduction.php +++ b/tests/Examples/Generated/EnabledInProduction.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/EnvEnvTest.php b/tests/Examples/Generated/EnvEnvTest.php index 4bbdf384..2a12a253 100644 --- a/tests/Examples/Generated/EnvEnvTest.php +++ b/tests/Examples/Generated/EnvEnvTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/EventListenerMyTaskTest.php b/tests/Examples/Generated/EventListenerMyTaskTest.php index e3db3435..2df5fc8a 100644 --- a/tests/Examples/Generated/EventListenerMyTaskTest.php +++ b/tests/Examples/Generated/EventListenerMyTaskTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FailureAllowFailureTest.php b/tests/Examples/Generated/FailureAllowFailureTest.php index 0604db5c..85af7e3a 100644 --- a/tests/Examples/Generated/FailureAllowFailureTest.php +++ b/tests/Examples/Generated/FailureAllowFailureTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FailureFailureTest.php b/tests/Examples/Generated/FailureFailureTest.php index 9527b4bd..0757bdc7 100644 --- a/tests/Examples/Generated/FailureFailureTest.php +++ b/tests/Examples/Generated/FailureFailureTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FilesystemFilesystemTest.php b/tests/Examples/Generated/FilesystemFilesystemTest.php index f36727d8..66dbe830 100644 --- a/tests/Examples/Generated/FilesystemFilesystemTest.php +++ b/tests/Examples/Generated/FilesystemFilesystemTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FilesystemFindTest.php b/tests/Examples/Generated/FilesystemFindTest.php index 9972dad4..af017e9e 100644 --- a/tests/Examples/Generated/FilesystemFindTest.php +++ b/tests/Examples/Generated/FilesystemFindTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FooBarTest.php b/tests/Examples/Generated/FooBarTest.php index e15b30be..75669fa0 100644 --- a/tests/Examples/Generated/FooBarTest.php +++ b/tests/Examples/Generated/FooBarTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/FooFooTest.php b/tests/Examples/Generated/FooFooTest.php index 00610096..23218936 100644 --- a/tests/Examples/Generated/FooFooTest.php +++ b/tests/Examples/Generated/FooFooTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/HelloTest.php b/tests/Examples/Generated/HelloTest.php index 0905d4cb..47d8bd76 100644 --- a/tests/Examples/Generated/HelloTest.php +++ b/tests/Examples/Generated/HelloTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/HttpRequestTest.php b/tests/Examples/Generated/HttpRequestTest.php index 62cb77d1..439a8336 100644 --- a/tests/Examples/Generated/HttpRequestTest.php +++ b/tests/Examples/Generated/HttpRequestTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportComposerSourceTest.php b/tests/Examples/Generated/ImportComposerSourceTest.php index 86cc9e6d..3266d42e 100644 --- a/tests/Examples/Generated/ImportComposerSourceTest.php +++ b/tests/Examples/Generated/ImportComposerSourceTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportFileNotExistTest.php b/tests/Examples/Generated/ImportFileNotExistTest.php index 20252b38..44a8dcaa 100644 --- a/tests/Examples/Generated/ImportFileNotExistTest.php +++ b/tests/Examples/Generated/ImportFileNotExistTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportInvalidFormatTest.php b/tests/Examples/Generated/ImportInvalidFormatTest.php index f5365499..bb3079da 100644 --- a/tests/Examples/Generated/ImportInvalidFormatTest.php +++ b/tests/Examples/Generated/ImportInvalidFormatTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportInvalidImportTest.php b/tests/Examples/Generated/ImportInvalidImportTest.php index ac35bb25..6ed9589e 100644 --- a/tests/Examples/Generated/ImportInvalidImportTest.php +++ b/tests/Examples/Generated/ImportInvalidImportTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportInvalidPackageTest.php b/tests/Examples/Generated/ImportInvalidPackageTest.php index 157427a0..22e87f97 100644 --- a/tests/Examples/Generated/ImportInvalidPackageTest.php +++ b/tests/Examples/Generated/ImportInvalidPackageTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php index 44f27478..d1546256 100644 --- a/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php +++ b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/LayoutWithFolder.php b/tests/Examples/Generated/LayoutWithFolder.php index 3456d7bb..c507b094 100644 --- a/tests/Examples/Generated/LayoutWithFolder.php +++ b/tests/Examples/Generated/LayoutWithFolder.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/LayoutWithOldFolder.php b/tests/Examples/Generated/LayoutWithOldFolder.php index f29ae2ba..e71c4b62 100644 --- a/tests/Examples/Generated/LayoutWithOldFolder.php +++ b/tests/Examples/Generated/LayoutWithOldFolder.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ListTest.php b/tests/Examples/Generated/ListTest.php index 637797af..2ce94c33 100644 --- a/tests/Examples/Generated/ListTest.php +++ b/tests/Examples/Generated/ListTest.php @@ -17,10 +17,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NewProjectInitTest.php b/tests/Examples/Generated/NewProjectInitTest.php index 8e861631..cf244aaa 100644 --- a/tests/Examples/Generated/NewProjectInitTest.php +++ b/tests/Examples/Generated/NewProjectInitTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NewProjectTest.php b/tests/Examples/Generated/NewProjectTest.php index 11474bc9..37d3d666 100644 --- a/tests/Examples/Generated/NewProjectTest.php +++ b/tests/Examples/Generated/NewProjectTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NoConfigCompletionTest.php b/tests/Examples/Generated/NoConfigCompletionTest.php index 3fa316e5..fdebcf94 100644 --- a/tests/Examples/Generated/NoConfigCompletionTest.php +++ b/tests/Examples/Generated/NoConfigCompletionTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NoConfigUnknownTest.php b/tests/Examples/Generated/NoConfigUnknownTest.php index 589ecc84..a895916a 100644 --- a/tests/Examples/Generated/NoConfigUnknownTest.php +++ b/tests/Examples/Generated/NoConfigUnknownTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php b/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php index 18813946..7a64bf6c 100644 --- a/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php +++ b/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NoDefaultContextTest.php b/tests/Examples/Generated/NoDefaultContextTest.php index 83bd4059..266d3f58 100644 --- a/tests/Examples/Generated/NoDefaultContextTest.php +++ b/tests/Examples/Generated/NoDefaultContextTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NoNamespaceTest.php b/tests/Examples/Generated/NoNamespaceTest.php index f438bb6e..6571c530 100644 --- a/tests/Examples/Generated/NoNamespaceTest.php +++ b/tests/Examples/Generated/NoNamespaceTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NotRenameRenamedTest.php b/tests/Examples/Generated/NotRenameRenamedTest.php index 4ac92e3b..471ac364 100644 --- a/tests/Examples/Generated/NotRenameRenamedTest.php +++ b/tests/Examples/Generated/NotRenameRenamedTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NotifyNotifyOnFinishTest.php b/tests/Examples/Generated/NotifyNotifyOnFinishTest.php index 1b8014ce..686d37a8 100644 --- a/tests/Examples/Generated/NotifyNotifyOnFinishTest.php +++ b/tests/Examples/Generated/NotifyNotifyOnFinishTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/NotifySendNotifyTest.php b/tests/Examples/Generated/NotifySendNotifyTest.php index c0413c81..3e147126 100644 --- a/tests/Examples/Generated/NotifySendNotifyTest.php +++ b/tests/Examples/Generated/NotifySendNotifyTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/OutputOutputTest.php b/tests/Examples/Generated/OutputOutputTest.php index 002ed16b..5e8413c3 100644 --- a/tests/Examples/Generated/OutputOutputTest.php +++ b/tests/Examples/Generated/OutputOutputTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ParallelExceptionTest.php b/tests/Examples/Generated/ParallelExceptionTest.php index 62324cd2..e51e405d 100644 --- a/tests/Examples/Generated/ParallelExceptionTest.php +++ b/tests/Examples/Generated/ParallelExceptionTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ParallelSleepTest.php b/tests/Examples/Generated/ParallelSleepTest.php index b8f935f5..2655843a 100644 --- a/tests/Examples/Generated/ParallelSleepTest.php +++ b/tests/Examples/Generated/ParallelSleepTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/QuietQuietTest.php b/tests/Examples/Generated/QuietQuietTest.php index 68755fbc..b4201b0b 100644 --- a/tests/Examples/Generated/QuietQuietTest.php +++ b/tests/Examples/Generated/QuietQuietTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/RunTestFileTest.php b/tests/Examples/Generated/RunTestFileTest.php index 4411daa0..253b9ffd 100644 --- a/tests/Examples/Generated/RunTestFileTest.php +++ b/tests/Examples/Generated/RunTestFileTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/RunVariablesTest.php b/tests/Examples/Generated/RunVariablesTest.php index 3e8ecb16..3ef921c2 100644 --- a/tests/Examples/Generated/RunVariablesTest.php +++ b/tests/Examples/Generated/RunVariablesTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/RunWhoamiTest.php b/tests/Examples/Generated/RunWhoamiTest.php index ee5674d1..f6d69ebb 100644 --- a/tests/Examples/Generated/RunWhoamiTest.php +++ b/tests/Examples/Generated/RunWhoamiTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/RunWithProcessHelperTest.php b/tests/Examples/Generated/RunWithProcessHelperTest.php index 5824c203..7f1c54e0 100644 --- a/tests/Examples/Generated/RunWithProcessHelperTest.php +++ b/tests/Examples/Generated/RunWithProcessHelperTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ShellBashTest.php b/tests/Examples/Generated/ShellBashTest.php index d65e7af2..8ca0ff97 100644 --- a/tests/Examples/Generated/ShellBashTest.php +++ b/tests/Examples/Generated/ShellBashTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/ShellShTest.php b/tests/Examples/Generated/ShellShTest.php index 877d9394..4c1b2089 100644 --- a/tests/Examples/Generated/ShellShTest.php +++ b/tests/Examples/Generated/ShellShTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/SignalSigusr2Test.php b/tests/Examples/Generated/SignalSigusr2Test.php index 59fcd5d6..bac195a6 100644 --- a/tests/Examples/Generated/SignalSigusr2Test.php +++ b/tests/Examples/Generated/SignalSigusr2Test.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/SymfonyGreetTest.php b/tests/Examples/Generated/SymfonyGreetTest.php index 80c247c5..ead5c628 100644 --- a/tests/Examples/Generated/SymfonyGreetTest.php +++ b/tests/Examples/Generated/SymfonyGreetTest.php @@ -17,10 +17,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/SymfonyHelloTest.php b/tests/Examples/Generated/SymfonyHelloTest.php index 81a2d60a..5e187510 100644 --- a/tests/Examples/Generated/SymfonyHelloTest.php +++ b/tests/Examples/Generated/SymfonyHelloTest.php @@ -17,10 +17,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/TwoDefaultContextTest.php b/tests/Examples/Generated/TwoDefaultContextTest.php index 8a0128e7..ca84a2a2 100644 --- a/tests/Examples/Generated/TwoDefaultContextTest.php +++ b/tests/Examples/Generated/TwoDefaultContextTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php b/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php index 1ad88d14..989b464a 100644 --- a/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php +++ b/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/VersionGuardMinVersionCheckTest.php b/tests/Examples/Generated/VersionGuardMinVersionCheckTest.php index d136d870..38fa323f 100644 --- a/tests/Examples/Generated/VersionGuardMinVersionCheckTest.php +++ b/tests/Examples/Generated/VersionGuardMinVersionCheckTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForCustomWaitForTaskTest.php b/tests/Examples/Generated/WaitForCustomWaitForTaskTest.php index 8025ab34..84568e6c 100644 --- a/tests/Examples/Generated/WaitForCustomWaitForTaskTest.php +++ b/tests/Examples/Generated/WaitForCustomWaitForTaskTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForWaitForDockerContainerTaskTest.php b/tests/Examples/Generated/WaitForWaitForDockerContainerTaskTest.php index 439b73b3..e2e555be 100644 --- a/tests/Examples/Generated/WaitForWaitForDockerContainerTaskTest.php +++ b/tests/Examples/Generated/WaitForWaitForDockerContainerTaskTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForWaitForPortTaskTest.php b/tests/Examples/Generated/WaitForWaitForPortTaskTest.php index 005a1fa0..0e39c089 100644 --- a/tests/Examples/Generated/WaitForWaitForPortTaskTest.php +++ b/tests/Examples/Generated/WaitForWaitForPortTaskTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForWaitForUrlTaskTest.php b/tests/Examples/Generated/WaitForWaitForUrlTaskTest.php index f58413f7..b0c7638b 100644 --- a/tests/Examples/Generated/WaitForWaitForUrlTaskTest.php +++ b/tests/Examples/Generated/WaitForWaitForUrlTaskTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForWaitForUrlWithSpecificResponseContentAndStatusTest.php b/tests/Examples/Generated/WaitForWaitForUrlWithSpecificResponseContentAndStatusTest.php index e42078ce..7c198e3a 100644 --- a/tests/Examples/Generated/WaitForWaitForUrlWithSpecificResponseContentAndStatusTest.php +++ b/tests/Examples/Generated/WaitForWaitForUrlWithSpecificResponseContentAndStatusTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/WaitForWaitForUrlWithStatusCodeOnlyTest.php b/tests/Examples/Generated/WaitForWaitForUrlWithStatusCodeOnlyTest.php index 32c9adb8..9b60fb21 100644 --- a/tests/Examples/Generated/WaitForWaitForUrlWithStatusCodeOnlyTest.php +++ b/tests/Examples/Generated/WaitForWaitForUrlWithStatusCodeOnlyTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/YamlDumpTest.php b/tests/Examples/Generated/YamlDumpTest.php index ac346164..1f30ba72 100644 --- a/tests/Examples/Generated/YamlDumpTest.php +++ b/tests/Examples/Generated/YamlDumpTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/Generated/YamlParseTest.php b/tests/Examples/Generated/YamlParseTest.php index 29ffadf9..9bbf7d7b 100644 --- a/tests/Examples/Generated/YamlParseTest.php +++ b/tests/Examples/Generated/YamlParseTest.php @@ -13,10 +13,6 @@ public function test(): void $this->assertSame(0, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); - if (file_exists(__FILE__ . '.err.txt')) { - $this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); - } else { - $this->assertSame('', $process->getErrorOutput()); - } + $this->assertSame('', $process->getErrorOutput()); } } diff --git a/tests/Examples/ListOnStaticBinTest.php b/tests/Examples/ListOnStaticBinTest.php index 777ec64d..4a2d433e 100644 --- a/tests/Examples/ListOnStaticBinTest.php +++ b/tests/Examples/ListOnStaticBinTest.php @@ -11,7 +11,7 @@ class ListOnStaticBinTest extends TaskTestCase public function test(): void { if (!self::$binary) { - $this->markTestSkipped('This test for the binary version of Castor.'); + $this->markTestSkipped('This test is for the binary version of Castor.'); } $process = $this->runTask(['list', '--raw', '--format', 'txt', '--short']); diff --git a/tests/TaskTestCase.php b/tests/TaskTestCase.php index 8d96f684..290f9763 100644 --- a/tests/TaskTestCase.php +++ b/tests/TaskTestCase.php @@ -9,8 +9,8 @@ abstract class TaskTestCase extends TestCase { - static string $castorBin; - static bool $binary = false; + public static string $castorBin; + public static bool $binary = false; public static function setUpBeforeClass(): void {