diff --git a/.gitignore b/.gitignore index 5a685f78..f8d3ef6a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /my-app.* /var/ /vendor/ +/tests/Examples/fixtures/**/.castor.stub.php diff --git a/bin/generate-tests.php b/bin/generate-tests.php index f3ea75b4..53558b7e 100755 --- a/bin/generate-tests.php +++ b/bin/generate-tests.php @@ -123,7 +123,7 @@ ; foreach ($dirs as $dir) { $class = u($dir->getRelativePath())->camel()->title()->append('Test')->toString(); - add_test([], $class, '{{ base }}/tests/Examples/fixtures/broken/' . $dir->getRelativePath()); + add_test([], $class, '{{ base }}/tests/Examples/fixtures/broken/' . $dir->getRelativePath(), true); } add_test(['args:passthru', 'a', 'b', '--no', '--foo', 'bar', '-x'], 'ArgPassthruExpanded'); @@ -142,7 +142,7 @@ add_test(['unknown:task'], 'NoConfigUnknownTest', '/tmp'); add_test([], 'NewProjectTest', '/tmp'); -function add_test(array $args, string $class, ?string $cwd = null) +function add_test(array $args, string $class, ?string $cwd = null, bool $needRemote = false) { $fp = fopen(__FILE__, 'r'); fseek($fp, __COMPILER_HALT_OFFSET__ + 1); @@ -152,9 +152,9 @@ function add_test(array $args, string $class, ?string $cwd = null) [\PHP_BINARY, __DIR__ . '/castor', '--no-ansi', ...$args], cwd: $cwd ? str_replace('{{ base }}', __DIR__ . '/..', $cwd) : __DIR__ . '/..', env: [ - 'COLUMNS' => 120, + 'COLUMNS' => 1000, 'ENDPOINT' => $_SERVER['ENDPOINT'], - 'CASTOR_NO_REMOTE' => 1, + 'CASTOR_NO_REMOTE' => $needRemote ? 0 : 1, ], timeout: null, ); @@ -166,6 +166,7 @@ function add_test(array $args, string $class, ?string $cwd = null) '{{ args }}' => implode(', ', array_map(fn ($arg) => var_export($arg, true), $args)), '{{ exitCode }}' => $process->getExitCode(), '{{ cwd }}' => $cwd ? ', ' . var_export($cwd, true) : '', + '{{ needRemote }}' => $needRemote ? ', needRemote: true' : '', ]); file_put_contents(__DIR__ . '/../tests/Examples/Generated/' . $class . '.php', $code); @@ -188,7 +189,7 @@ class {{ class_name }} extends TaskTestCase // {{ task }} public function test(): void { - $process = $this->runTask([{{ args }}]{{ cwd }}); + $process = $this->runTask([{{ args }}]{{ cwd }}{{ needRemote }}); $this->assertSame({{ exitCode }}, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/composer.json b/composer.json index 9196fa27..fa6359fb 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,10 @@ "psr-4": { "Castor\\": "src/" }, - "files": ["src/functions.php"] + "files": [ + "src/functions.php", + "src/functions-internal.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/doc/going-further/extending-castor/remote-imports.md b/doc/going-further/extending-castor/remote-imports.md index 125cd1e3..fd835fbd 100644 --- a/doc/going-further/extending-castor/remote-imports.md +++ b/doc/going-further/extending-castor/remote-imports.md @@ -75,7 +75,7 @@ import('composer://vendor-name/project-name', source: [ ``` > [!NOTE] -> The "vendor-name/project-name" name can be whatever you want and we only be +> The "vendor-name/project-name" name can be whatever you want, and will only be > used internally by Castor and Composer to make the repository behave like a > normal Composer package. diff --git a/phpstan.neon b/phpstan.neon index ad244234..a3e1c0a1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -19,3 +19,10 @@ parameters: foo?: string, } ''' + ImportSource: ''' + array{ + url?: string, + type?: "git" | "svn", + reference?: string, + } + ''' diff --git a/src/Console/Application.php b/src/Console/Application.php index fb3fe4b0..1bf9f15d 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -21,8 +21,8 @@ use Castor\Fingerprint\FingerprintHelper; use Castor\FunctionFinder; use Castor\GlobalHelper; +use Castor\Import\Importer; use Castor\PlatformHelper; -use Castor\Remote\Importer; use Castor\WaitForHelper; use Monolog\Logger; use Psr\Cache\CacheItemPoolInterface; diff --git a/src/Console/ApplicationFactory.php b/src/Console/ApplicationFactory.php index 22169dff..f38251a2 100644 --- a/src/Console/ApplicationFactory.php +++ b/src/Console/ApplicationFactory.php @@ -10,15 +10,15 @@ use Castor\ExpressionLanguage; use Castor\Fingerprint\FingerprintHelper; use Castor\FunctionFinder; -use Castor\HasherHelper; +use Castor\Import\Importer; +use Castor\Import\Listener\RemoteImportListener; +use Castor\Import\Remote\Composer; +use Castor\Import\Remote\PackageImporter; use Castor\Listener\GenerateStubsListener; use Castor\Listener\UpdateCastorListener; use Castor\Monolog\Processor\ProcessProcessor; use Castor\PathHelper; use Castor\PlatformHelper; -use Castor\Remote\Composer; -use Castor\Remote\Importer; -use Castor\Remote\Listener\RemoteImportListener; use Castor\Stub\StubsGenerator; use Castor\WaitForHelper; use Monolog\Logger; @@ -54,7 +54,8 @@ public static function create(): SymfonyApplication $logger = new Logger('castor', [], [new ProcessProcessor()]); $fs = new Filesystem(); $fingerprintHelper = new FingerprintHelper($cache); - $importer = new Importer($logger, new Composer($fs, $logger, $fingerprintHelper)); + $packageImporter = new PackageImporter($logger, new Composer($fs, $logger, $fingerprintHelper)); + $importer = new Importer($packageImporter, $logger); $eventDispatcher = new EventDispatcher(logger: $logger); $eventDispatcher->addSubscriber(new UpdateCastorListener( $cache, @@ -65,9 +66,9 @@ public static function create(): SymfonyApplication new StubsGenerator($logger), $rootDir, )); - $eventDispatcher->addSubscriber(new RemoteImportListener($importer)); + $eventDispatcher->addSubscriber(new RemoteImportListener($packageImporter)); - /** @var SymfonyApplication */ + /** @var Application */ // @phpstan-ignore-next-line $application = new $class( $rootDir, @@ -85,7 +86,7 @@ public static function create(): SymfonyApplication ); // Avoid dependency cycle - $importer->setApplication($application); + $packageImporter->setApplication($application); $application->setDispatcher($eventDispatcher); $application->add(new DebugCommand($rootDir, $cacheDir, $contextRegistry)); diff --git a/src/FunctionFinder.php b/src/FunctionFinder.php index 47928376..a0a221ed 100644 --- a/src/FunctionFinder.php +++ b/src/FunctionFinder.php @@ -243,16 +243,3 @@ private function resolveListeners(\ReflectionFunction $reflectionFunction): iter } } } - -// Don't leak internal variables -/** @internal */ -function castor_require(string $file): void -{ - if (!is_file($file)) { - throw new \RuntimeException(sprintf('Could not find file "%s".', $file)); - } - - FunctionFinder::$files[] = $file; - - require_once $file; -} diff --git a/src/Import/Exception/ComposerError.php b/src/Import/Exception/ComposerError.php new file mode 100644 index 00000000..2ebca25f --- /dev/null +++ b/src/Import/Exception/ComposerError.php @@ -0,0 +1,7 @@ +packageImporter->importPackage( + $scheme, + $package, + $file, + $version, + $vcs, + $source, + ); + + return; + } catch (ImportError $e) { + throw $this->createImportException($package, $e->getMessage(), $e); + } catch (RemoteNotAllowed $e) { + $this->logger->warning($this->getImportLocatedMessage($path, $e->getMessage(), 1)); + + return; + } + } elseif (null !== $file || null !== $version || null !== $vcs || null !== $source) { + throw $this->createImportException($path, 'The "file", "version", "vcs" and "source" arguments can only be used with a remote import.'); + } + + if (!file_exists($path)) { + throw $this->createImportException($path, sprintf('The file "%s" does not exist.', $path)); + } + + if (is_file($path)) { + castor_require($path); + } + + if (is_dir($path)) { + $files = Finder::create() + ->files() + ->name('*.php') + ->in($path) + ; + + foreach ($files as $file) { + castor_require($file->getPathname()); + } + } + } + + private function getImportLocatedMessage(string $path, string $reason, int $depth): string + { + /** @var array{file: string, line: int} $caller */ + $caller = debug_backtrace()[$depth + 1]; + + return sprintf( + 'Could not import "%s" in "%s" on line %d. Reason: %s', + $path, + $caller['file'], + $caller['line'], + $reason, + ); + } + + private function createImportException(string $path, string $message, ?\Throwable $e = null): \Throwable + { + $depth = 2; + + return fix_exception( + new \InvalidArgumentException($this->getImportLocatedMessage($path, $message, $depth), previous: $e), + $depth + ); + } +} diff --git a/src/Remote/Listener/RemoteImportListener.php b/src/Import/Listener/RemoteImportListener.php similarity index 71% rename from src/Remote/Listener/RemoteImportListener.php rename to src/Import/Listener/RemoteImportListener.php index 4778ed13..95f2ffee 100644 --- a/src/Remote/Listener/RemoteImportListener.php +++ b/src/Import/Listener/RemoteImportListener.php @@ -1,16 +1,16 @@ importer->fetchPackages($event->application->getInput()); + $this->packageImporter->fetchPackages($event->application->getInput()); } } diff --git a/src/Remote/Composer.php b/src/Import/Remote/Composer.php similarity index 97% rename from src/Remote/Composer.php rename to src/Import/Remote/Composer.php index e56b0d13..8db27855 100644 --- a/src/Remote/Composer.php +++ b/src/Import/Remote/Composer.php @@ -1,20 +1,18 @@ application = $application; } - /** - * @param ?array{ - * url?: string, - * type?: "git" | "svn", - * reference?: string, - * } $source - */ - public function importFunctionsFrom(string $scheme, string $package, ?string $file = null, ?string $version = null, ?string $vcs = null, ?array $source = null): void + /** @phpstan-param ImportSource $source */ + public function importPackage(string $scheme, string $package, ?string $file = null, ?string $version = null, ?string $vcs = null, ?array $source = null): void { if (!$this->allowsRemote()) { - throw new ImportError(sprintf('Remote imports are disabled, skipping import of "%s".', $package)); + throw new RemoteNotAllowed('Remote imports are disabled.'); } if (isset($this->imports[$package]) && $this->imports[$package]->version !== $version) { @@ -78,6 +71,10 @@ public function importFunctionsFrom(string $scheme, string $package, ?string $fi public function fetchPackages(InputInterface $input): void { + if (!$this->application) { + throw new \RuntimeException('The application must be set before calling fetchPackages()'); + } + if (!$this->imports) { $this->composer->remove(); @@ -100,7 +97,7 @@ public function fetchPackages(InputInterface $input): void foreach ($this->imports as $package => $import) { foreach ($import->getFiles() as $file) { - import(PathHelper::getRoot() . Composer::VENDOR_DIR . $package . '/' . ($file ?? '')); + $this->application->importer->import(PathHelper::getRoot() . Composer::VENDOR_DIR . $package . '/' . ($file ?? '')); } } } @@ -157,6 +154,10 @@ private function allowsRemote(): bool return false; } + if (!$this->application) { + throw new \RuntimeException('The application must be set before calling allowsRemote()'); + } + $input = $this->application->getInput(); // Need to look for the raw options as the input is not yet parsed @@ -166,7 +167,7 @@ private function allowsRemote(): bool class Import { - /** @var string[] */ + /** @var array */ private array $files; public function __construct( @@ -174,11 +175,12 @@ public function __construct( ) { } - public function addFile(?string $file = null) + public function addFile(?string $file = null): void { $this->files[] = $file; } + /** @return array */ public function getFiles(): array { return array_unique($this->files); diff --git a/src/Remote/Exception/ComposerError.php b/src/Remote/Exception/ComposerError.php deleted file mode 100644 index 98506db9..00000000 --- a/src/Remote/Exception/ComposerError.php +++ /dev/null @@ -1,7 +0,0 @@ -getTrace()[$depth]; + foreach (['file', 'line'] as $key) { + if (!\array_key_exists($key, $lastFrame)) { + continue; + } + $r = new \ReflectionProperty(\Exception::class, $key); + $r->setAccessible(true); + $r->setValue($exception, $lastFrame[$key]); + } + + return $exception; +} diff --git a/src/functions.php b/src/functions.php index b9e5e226..78fd5b95 100644 --- a/src/functions.php +++ b/src/functions.php @@ -8,8 +8,6 @@ use Castor\Exception\MinimumVersionRequirementNotMetException; use Castor\Exception\WaitFor\ExitedBeforeTimeoutException; use Castor\Exception\WaitFor\TimeoutReachedException; -use Castor\Remote\Exception\ImportError; -use Castor\Remote\Exception\InvalidImportFormat; use Joli\JoliNotif\Notification; use Joli\JoliNotif\NotifierFactory; use JoliCode\PhpOsHelper\OsHelper; @@ -773,70 +771,7 @@ function http_client(): HttpClientInterface */ function import(string $path, ?string $file = null, ?string $version = null, ?string $vcs = null, ?array $source = null): void { - $scheme = parse_url($path, \PHP_URL_SCHEME); - - if ($scheme) { - try { - GlobalHelper::getApplication()->importer->importFunctionsFrom( - $scheme, - mb_substr($path, mb_strlen($scheme) + 3), - $file, - $version, - $vcs, - $source, - ); - - return; - } catch (InvalidImportFormat $e) { - throw fix_exception(new \InvalidArgumentException($e->getMessage(), 0, $e)); - } catch (ImportError $e) { - log($e->getMessage(), 'warning'); - - return; - } - } elseif (null !== $file || null !== $version || null !== $vcs || null !== $source) { - throw fix_exception(new \InvalidArgumentException('The "file", "version", "vcs" and "source" arguments can only be used with a remote import.')); - } - - if (!file_exists($path)) { - throw fix_exception(new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $path))); - } - - if (is_file($path)) { - castor_require($path); - } - - if (is_dir($path)) { - $files = Finder::create() - ->files() - ->name('*.php') - ->in($path) - ; - - foreach ($files as $file) { - castor_require($file->getPathname()); - } - } -} - -/** - * Remove the last frame (the call to run() to display a nice message to the end user. - * - * @internal - */ -function fix_exception(\Exception $exception): \Exception -{ - $lastFrame = $exception->getTrace()[0]; - foreach (['file', 'line'] as $key) { - if (!\array_key_exists($key, $lastFrame)) { - continue; - } - $r = new \ReflectionProperty(\Exception::class, $key); - $r->setAccessible(true); - $r->setValue($exception, $lastFrame[$key]); - } - - return $exception; + GlobalHelper::getApplication()->importer->import($path, $file, $version, $vcs, $source); } /** diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_not_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_not_runnable.txt index c8642a88..e232b1fb 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_not_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_not_runnable.txt @@ -1,5 +1,2 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool! I finished! diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_runnable.txt index 2c9190c8..4eb89b59 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintAndForceTest.php.output_runnable.txt @@ -1,6 +1,3 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool, no fingerprint! Executing... Fingerprint has been executed! diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_not_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_not_runnable.txt index c8642a88..e232b1fb 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_not_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_not_runnable.txt @@ -1,5 +1,2 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool! I finished! diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_runnable.txt index 47b5600a..00f0ed61 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_runnable.txt @@ -1,6 +1,3 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool, no fingerprint! Executing... Cool! I finished! diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_not_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_not_runnable.txt index c8642a88..e232b1fb 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_not_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_not_runnable.txt @@ -1,5 +1,2 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool! I finished! diff --git a/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_runnable.txt b/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_runnable.txt index 47b5600a..00f0ed61 100644 --- a/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_runnable.txt +++ b/tests/Examples/Fingerprint/FingerprintTaskWithCompleteFingerprintTest.php.output_runnable.txt @@ -1,6 +1,3 @@ -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/castor-example-package-not-published". -hh:ii:ss WARNING [castor] Remote imports are disabled, skipping import of "pyrech/foobar". Hello Task with Fingerprint! Cool, no fingerprint! Executing... Cool! I finished! diff --git a/tests/Examples/Generated/AutocompleteInvalidTest.php b/tests/Examples/Generated/AutocompleteInvalidTest.php index 03b5c992..2531c1e2 100644 --- a/tests/Examples/Generated/AutocompleteInvalidTest.php +++ b/tests/Examples/Generated/AutocompleteInvalidTest.php @@ -9,7 +9,7 @@ class AutocompleteInvalidTest extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/autocomplete-invalid'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/autocomplete-invalid', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/AutocompleteInvalidTest.php.err.txt b/tests/Examples/Generated/AutocompleteInvalidTest.php.err.txt index 737f0c76..c0c5086e 100644 --- a/tests/Examples/Generated/AutocompleteInvalidTest.php.err.txt +++ b/tests/Examples/Generated/AutocompleteInvalidTest.php.err.txt @@ -1,8 +1,7 @@ - In TaskCommand.php line 238: - - Function "autocomplete_argument()" is not properly configured: - The value provided in the "autocomplete" option on parameter "argument" is not callable. - Defined in "castor.php" line 8. - + + Function "autocomplete_argument()" is not properly configured: + The value provided in the "autocomplete" option on parameter "argument" is not callable. + Defined in "castor.php" line 8. + diff --git a/tests/Examples/Generated/ContextContextDoNotExistTest.php.err.txt b/tests/Examples/Generated/ContextContextDoNotExistTest.php.err.txt index 095539da..4a860348 100644 --- a/tests/Examples/Generated/ContextContextDoNotExistTest.php.err.txt +++ b/tests/Examples/Generated/ContextContextDoNotExistTest.php.err.txt @@ -1,6 +1,5 @@ - In ContextRegistry.php line XXXX: - - Context "no_no_exist" not found. - + + Context "no_no_exist" not found. + diff --git a/tests/Examples/Generated/ContextGeneratorArg2Test.php b/tests/Examples/Generated/ContextGeneratorArg2Test.php index 995c4c27..bbf112be 100644 --- a/tests/Examples/Generated/ContextGeneratorArg2Test.php +++ b/tests/Examples/Generated/ContextGeneratorArg2Test.php @@ -9,7 +9,7 @@ class ContextGeneratorArg2Test extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-arg-2'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-arg-2', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt b/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt index afa7afb4..10da9a3c 100644 --- a/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt @@ -1,8 +1,7 @@ - In FunctionFinder.php line 223: - - Function "gen()" is not properly configured: - The context generator "foo" must not have arguments. - Defined in "castor.php" line 7. - + + Function "gen()" is not properly configured: + The context generator "foo" must not have arguments. + Defined in "castor.php" line 7. + diff --git a/tests/Examples/Generated/ContextGeneratorArgTest.php b/tests/Examples/Generated/ContextGeneratorArgTest.php index b9051317..965066a2 100644 --- a/tests/Examples/Generated/ContextGeneratorArgTest.php +++ b/tests/Examples/Generated/ContextGeneratorArgTest.php @@ -9,7 +9,7 @@ class ContextGeneratorArgTest extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-arg'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-arg', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt b/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt index afa333da..b389544d 100644 --- a/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt @@ -1,8 +1,7 @@ - In FunctionFinder.php line 214: - - Function "gen()" is not properly configured: - The contexts generator must not have arguments. - Defined in "castor.php" line 7. - + + Function "gen()" is not properly configured: + The contexts generator must not have arguments. + Defined in "castor.php" line 7. + diff --git a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php index c6ce84ed..22fc735c 100644 --- a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php +++ b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php @@ -9,7 +9,7 @@ class ContextGeneratorNotCallableTest extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-not-callable'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/context-generator-not-callable', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt index f07726cc..2bdbde72 100644 --- a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt @@ -1,8 +1,7 @@ - In FunctionFinder.php line 219: - - Function "gen()" is not properly configured: - The context generator "foo" is not callable. - Defined in "castor.php" line 6. - + + Function "gen()" is not properly configured: + The context generator "foo" is not callable. + Defined in "castor.php" line 6. + diff --git a/tests/Examples/Generated/FailureFailureTest.php.err.txt b/tests/Examples/Generated/FailureFailureTest.php.err.txt index 86a74933..dba37145 100644 --- a/tests/Examples/Generated/FailureFailureTest.php.err.txt +++ b/tests/Examples/Generated/FailureFailureTest.php.err.txt @@ -1,9 +1,9 @@ sh: 1: i_do_not_exist: not found In failure.php line 12: - - The command "i_do_not_exist" failed. - + + The command "i_do_not_exist" failed. + failure:failure diff --git a/tests/Examples/Generated/ImportComposerSourceTest.php b/tests/Examples/Generated/ImportComposerSourceTest.php new file mode 100644 index 00000000..86cc9e6d --- /dev/null +++ b/tests/Examples/Generated/ImportComposerSourceTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-composer-source', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportComposerSourceTest.php.err.txt b/tests/Examples/Generated/ImportComposerSourceTest.php.err.txt new file mode 100644 index 00000000..2e7635e4 --- /dev/null +++ b/tests/Examples/Generated/ImportComposerSourceTest.php.err.txt @@ -0,0 +1,10 @@ +In castor.php line 5: + + Could not import "foo/bar" in ".../tests/Examples/fixtures/broken/import-composer-source/castor.php" on line 5. Reason: The "source" argument is not supported for Composer/Packagist packages. + + +In PackageImporter.php line 48: + + The "source" argument is not supported for Composer/Packagist packages. + + diff --git a/tests/Examples/Generated/ImportComposerSourceTest.php.output.txt b/tests/Examples/Generated/ImportComposerSourceTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ImportFileNotExistTest.php b/tests/Examples/Generated/ImportFileNotExistTest.php new file mode 100644 index 00000000..20252b38 --- /dev/null +++ b/tests/Examples/Generated/ImportFileNotExistTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-file-not-exist', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportFileNotExistTest.php.err.txt b/tests/Examples/Generated/ImportFileNotExistTest.php.err.txt new file mode 100644 index 00000000..8f470b48 --- /dev/null +++ b/tests/Examples/Generated/ImportFileNotExistTest.php.err.txt @@ -0,0 +1,5 @@ +In castor.php line 5: + + Could not import "path/to/not/existing/castor.php" in ".../tests/Examples/fixtures/broken/import-file-not-exist/castor.php" on line 5. Reason: The file "path/to/not/existing/castor.php" does not exist. + + diff --git a/tests/Examples/Generated/ImportFileNotExistTest.php.output.txt b/tests/Examples/Generated/ImportFileNotExistTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ImportInvalidFormatTest.php b/tests/Examples/Generated/ImportInvalidFormatTest.php new file mode 100644 index 00000000..f5365499 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidFormatTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-invalid-format', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportInvalidFormatTest.php.err.txt b/tests/Examples/Generated/ImportInvalidFormatTest.php.err.txt new file mode 100644 index 00000000..3f7d0e85 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidFormatTest.php.err.txt @@ -0,0 +1,10 @@ +In castor.php line 5: + + Could not import "invalid-package-name" in ".../tests/Examples/fixtures/broken/import-invalid-format/castor.php" on line 5. Reason: The import path must be formatted like this: "composer:///". + + +In PackageImporter.php line 43: + + The import path must be formatted like this: "composer:///". + + diff --git a/tests/Examples/Generated/ImportInvalidFormatTest.php.output.txt b/tests/Examples/Generated/ImportInvalidFormatTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ImportInvalidImportTest.php b/tests/Examples/Generated/ImportInvalidImportTest.php new file mode 100644 index 00000000..ac35bb25 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidImportTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-invalid-import', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportInvalidImportTest.php.err.txt b/tests/Examples/Generated/ImportInvalidImportTest.php.err.txt new file mode 100644 index 00000000..dd9b2321 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidImportTest.php.err.txt @@ -0,0 +1,5 @@ +In castor.php line 5: + + Could not import "path-to-castor.php" in ".../tests/Examples/fixtures/broken/import-invalid-import/castor.php" on line 5. Reason: The "file", "version", "vcs" and "source" arguments can only be used with a remote import. + + diff --git a/tests/Examples/Generated/ImportInvalidImportTest.php.output.txt b/tests/Examples/Generated/ImportInvalidImportTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ImportInvalidPackageTest.php b/tests/Examples/Generated/ImportInvalidPackageTest.php new file mode 100644 index 00000000..157427a0 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidPackageTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-invalid-package', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportInvalidPackageTest.php.err.txt b/tests/Examples/Generated/ImportInvalidPackageTest.php.err.txt new file mode 100644 index 00000000..d1804ab9 --- /dev/null +++ b/tests/Examples/Generated/ImportInvalidPackageTest.php.err.txt @@ -0,0 +1,10 @@ +In castor.php line 5: + + Could not import "foo/bar" in ".../tests/Examples/fixtures/broken/import-invalid-package/castor.php" on line 5. Reason: The "source" argument must contain "url", "type" and "reference" keys. + + +In PackageImporter.php line 132: + + The "source" argument must contain "url", "type" and "reference" keys. + + diff --git a/tests/Examples/Generated/ImportInvalidPackageTest.php.output.txt b/tests/Examples/Generated/ImportInvalidPackageTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php new file mode 100644 index 00000000..44f27478 --- /dev/null +++ b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php @@ -0,0 +1,22 @@ +runTask([], '{{ base }}/tests/Examples/fixtures/broken/import-same-package-different-version', needRemote: true); + + $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()); + } + } +} diff --git a/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php.err.txt b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php.err.txt new file mode 100644 index 00000000..a8c796c5 --- /dev/null +++ b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php.err.txt @@ -0,0 +1,10 @@ +In castor.php line 6: + + Could not import "pyrech/castor-example" in ".../tests/Examples/fixtures/broken/import-same-package-different-version/castor.php" on line 6. Reason: The package "pyrech/castor-example" is already required in version "^1.0", could not require it in version "^2.0" + + +In PackageImporter.php line 39: + + The package "pyrech/castor-example" is already required in version "^1.0", could not require it in version "^2.0" + + diff --git a/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php.output.txt b/tests/Examples/Generated/ImportSamePackageDifferentVersionTest.php.output.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/Examples/Generated/ListTest.php.output.txt b/tests/Examples/Generated/ListTest.php.output.txt index 58c81566..fca33b24 100644 --- a/tests/Examples/Generated/ListTest.php.output.txt +++ b/tests/Examples/Generated/ListTest.php.output.txt @@ -64,7 +64,7 @@ signal:sigusr2 Captures SIGUS ssh:download Downloads a file from the remote server ssh:ls Lists content of /var/www directory on the remote server ssh:upload Uploads a file to the remote server -symfony:greet +symfony:greet symfony:hello Says hello from a symfony application version-guard:min-version-check Check if the minimum castor version requirement is met version-guard:min-version-check-fail Check if the minimum castor version requirement is met (fail) diff --git a/tests/Examples/Generated/NewProjectInitTest.php.output.txt b/tests/Examples/Generated/NewProjectInitTest.php.output.txt index a1bcf3a6..9075f9c9 100644 --- a/tests/Examples/Generated/NewProjectInitTest.php.output.txt +++ b/tests/Examples/Generated/NewProjectInitTest.php.output.txt @@ -1,5 +1,4 @@ - - [WARNING] Could not find root "castor.php" file. + [WARNING] Could not find root "castor.php" file. Do you want to create a new project? (yes/no) [no]: - > \ No newline at end of file + > \ No newline at end of file diff --git a/tests/Examples/Generated/NewProjectTest.php.output.txt b/tests/Examples/Generated/NewProjectTest.php.output.txt index a1bcf3a6..9075f9c9 100644 --- a/tests/Examples/Generated/NewProjectTest.php.output.txt +++ b/tests/Examples/Generated/NewProjectTest.php.output.txt @@ -1,5 +1,4 @@ - - [WARNING] Could not find root "castor.php" file. + [WARNING] Could not find root "castor.php" file. Do you want to create a new project? (yes/no) [no]: - > \ No newline at end of file + > \ No newline at end of file diff --git a/tests/Examples/Generated/NoConfigUnknownTest.php.output.txt b/tests/Examples/Generated/NoConfigUnknownTest.php.output.txt index a73dd08c..09f7cb8b 100644 --- a/tests/Examples/Generated/NoConfigUnknownTest.php.output.txt +++ b/tests/Examples/Generated/NoConfigUnknownTest.php.output.txt @@ -1,3 +1,2 @@ - - [ERROR] Could not find root "castor.php" file. Did you run castor in the right directory? + [ERROR] Could not find root "castor.php" file. Did you run castor in the right directory? diff --git a/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php.output.txt b/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php.output.txt index a73dd08c..09f7cb8b 100644 --- a/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php.output.txt +++ b/tests/Examples/Generated/NoConfigUnknownWithArgsTest.php.output.txt @@ -1,3 +1,2 @@ - - [ERROR] Could not find root "castor.php" file. Did you run castor in the right directory? + [ERROR] Could not find root "castor.php" file. Did you run castor in the right directory? diff --git a/tests/Examples/Generated/NoDefaultContextTest.php b/tests/Examples/Generated/NoDefaultContextTest.php index fe7286d0..83bd4059 100644 --- a/tests/Examples/Generated/NoDefaultContextTest.php +++ b/tests/Examples/Generated/NoDefaultContextTest.php @@ -9,7 +9,7 @@ class NoDefaultContextTest extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/no-default-context'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/no-default-context', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/NoDefaultContextTest.php.err.txt b/tests/Examples/Generated/NoDefaultContextTest.php.err.txt index 8400d780..3987debd 100644 --- a/tests/Examples/Generated/NoDefaultContextTest.php.err.txt +++ b/tests/Examples/Generated/NoDefaultContextTest.php.err.txt @@ -1,6 +1,5 @@ - In ContextRegistry.php line XXXX: - - Since there are multiple contexts "one", "two", you must set a "default: true" context. - + + Since there are multiple contexts "one", "two", you must set a "default: true" context. + diff --git a/tests/Examples/Generated/OutputOutputTest.php.err.txt b/tests/Examples/Generated/OutputOutputTest.php.err.txt index b213d548..c2b62f71 100644 --- a/tests/Examples/Generated/OutputOutputTest.php.err.txt +++ b/tests/Examples/Generated/OutputOutputTest.php.err.txt @@ -1,7 +1,6 @@ - - Aborted. - + Aborted. + output:output diff --git a/tests/Examples/Generated/OutputOutputTest.php.output.txt b/tests/Examples/Generated/OutputOutputTest.php.output.txt index 7c1df28b..dc70a6a6 100644 --- a/tests/Examples/Generated/OutputOutputTest.php.output.txt +++ b/tests/Examples/Generated/OutputOutputTest.php.output.txt @@ -1,10 +1,9 @@ - This is a title =============== This is the task "output:output" - // With IO, you can ask questions ... + // With IO, you can ask questions ... Tell me something: - > \ No newline at end of file + > \ No newline at end of file diff --git a/tests/Examples/Generated/ParallelExceptionTest.php.err.txt b/tests/Examples/Generated/ParallelExceptionTest.php.err.txt index c27b4bef..ffa867bc 100644 --- a/tests/Examples/Generated/ParallelExceptionTest.php.err.txt +++ b/tests/Examples/Generated/ParallelExceptionTest.php.err.txt @@ -1,24 +1,23 @@ - In parallel.php line 74: - - This is an exception - + + This is an exception + parallel:exception In parallel.php line 72: - - The command "exit 1" failed. - + + The command "exit 1" failed. + parallel:exception In functions.php line XXXX: - - One or more exceptions were thrown in parallel. - + + One or more exceptions were thrown in parallel. + parallel:exception diff --git a/tests/Examples/Generated/RunVariablesTest.php.output.txt b/tests/Examples/Generated/RunVariablesTest.php.output.txt index d1c38e0c..c87852b2 100644 --- a/tests/Examples/Generated/RunVariablesTest.php.output.txt +++ b/tests/Examples/Generated/RunVariablesTest.php.output.txt @@ -1,4 +1,4 @@ Output: ba'"`r -Error output: +Error output: Exit code: 0 diff --git a/tests/Examples/Generated/ShellBashTest.php.err.txt b/tests/Examples/Generated/ShellBashTest.php.err.txt index 4a10c49c..cf5a80c4 100644 --- a/tests/Examples/Generated/ShellBashTest.php.err.txt +++ b/tests/Examples/Generated/ShellBashTest.php.err.txt @@ -1,8 +1,7 @@ - In Process.php line XXXX: - - TTY mode requires /dev/tty to be read/writable. - + + TTY mode requires /dev/tty to be read/writable. + shell:bash diff --git a/tests/Examples/Generated/ShellShTest.php.err.txt b/tests/Examples/Generated/ShellShTest.php.err.txt index 274b38fd..b797ad16 100644 --- a/tests/Examples/Generated/ShellShTest.php.err.txt +++ b/tests/Examples/Generated/ShellShTest.php.err.txt @@ -1,8 +1,7 @@ - In Process.php line XXXX: - - TTY mode requires /dev/tty to be read/writable. - + + TTY mode requires /dev/tty to be read/writable. + shell:sh diff --git a/tests/Examples/Generated/TwoDefaultContextTest.php b/tests/Examples/Generated/TwoDefaultContextTest.php index 77667b72..8a0128e7 100644 --- a/tests/Examples/Generated/TwoDefaultContextTest.php +++ b/tests/Examples/Generated/TwoDefaultContextTest.php @@ -9,7 +9,7 @@ class TwoDefaultContextTest extends TaskTestCase // no task public function test(): void { - $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/two-default-context'); + $process = $this->runTask([], '{{ base }}/tests/Examples/fixtures/broken/two-default-context', needRemote: true); $this->assertSame(1, $process->getExitCode()); $this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); diff --git a/tests/Examples/Generated/TwoDefaultContextTest.php.err.txt b/tests/Examples/Generated/TwoDefaultContextTest.php.err.txt index c5612419..0fac524b 100644 --- a/tests/Examples/Generated/TwoDefaultContextTest.php.err.txt +++ b/tests/Examples/Generated/TwoDefaultContextTest.php.err.txt @@ -1,8 +1,7 @@ - In ContextRegistry.php line XXXX: - - Function "two()" is not properly configured: - You cannot define two contexts with the same name "default". There is one already defined in "castor.php:7". - Defined in "castor.php" line 13. - + + Function "two()" is not properly configured: + You cannot define two contexts with the same name "default". There is one already defined in "castor.php:7". + Defined in "castor.php" line 13. + diff --git a/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php.err.txt b/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php.err.txt index 4dddf571..fa990f5d 100644 --- a/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php.err.txt +++ b/tests/Examples/Generated/VersionGuardMinVersionCheckFailTest.php.err.txt @@ -1,8 +1,7 @@ - In version-guard.php line 18: - - This project requires Castor in version v999.0.0 or greater, you are using vX.Y.Z. Please consider upgrading. - + + This project requires Castor in version v999.0.0 or greater, you are using vX.Y.Z. Please consider upgrading. + version-guard:min-version-check-fail diff --git a/tests/Examples/Remote/RemoteImportRemoteTasksTest.php.output_no_update.txt b/tests/Examples/Remote/RemoteImportRemoteTasksTest.php.output_no_update.txt index 41083c96..4223ba3b 100644 --- a/tests/Examples/Remote/RemoteImportRemoteTasksTest.php.output_no_update.txt +++ b/tests/Examples/Remote/RemoteImportRemoteTasksTest.php.output_no_update.txt @@ -1,4 +1,3 @@ - Hello from example! =================== diff --git a/tests/Examples/fixtures/broken/import-composer-source/castor.php b/tests/Examples/fixtures/broken/import-composer-source/castor.php new file mode 100644 index 00000000..700119fa --- /dev/null +++ b/tests/Examples/fixtures/broken/import-composer-source/castor.php @@ -0,0 +1,5 @@ + 'git']); diff --git a/tests/Examples/fixtures/broken/import-file-not-exist/castor.php b/tests/Examples/fixtures/broken/import-file-not-exist/castor.php new file mode 100644 index 00000000..d4ba0fde --- /dev/null +++ b/tests/Examples/fixtures/broken/import-file-not-exist/castor.php @@ -0,0 +1,5 @@ + 'git']); diff --git a/tests/Examples/fixtures/broken/import-same-package-different-version/castor.php b/tests/Examples/fixtures/broken/import-same-package-different-version/castor.php new file mode 100644 index 00000000..62464849 --- /dev/null +++ b/tests/Examples/fixtures/broken/import-same-package-different-version/castor.php @@ -0,0 +1,6 @@ + $outputFilename, - 'CC_TEST_NAME' => $testName, - ]; + $extraEnv['CC_OUTPUT_FILENAME'] = $outputFilename; + $extraEnv['CC_TEST_NAME'] = $testName; } $process = new Process( [$castorBin, '--no-ansi', ...$args], cwd: $cwd ? str_replace('{{ base }}', __DIR__ . '/..', $cwd) : __DIR__ . '/..', env: [ - 'COLUMNS' => 120, + 'COLUMNS' => 1000, ...$extraEnv, ], );