Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Process::fake() never matches a multi-line command (or, Str::is() always returns false on multi-line strings) #50158

Closed
SjorsO opened this issue Feb 20, 2024 · 1 comment

Comments

@SjorsO
Copy link
Contributor

SjorsO commented Feb 20, 2024

Laravel Version

10.44.1

PHP Version

8.3.3

Database Driver & Version

n/a

Description

My code does this:

$result = Process::run(<<<BASH
git clone --depth 1 \
      --single-branch \
      --branch master \
      git://some-url .
BASH);

My test tries to do this:

Process::preventStrayProcesses();

Process::fake(['*' => 'faked output']);

This doesn't work and always throws an "Attempted process without a matching fake" exception because:

I've tried a bunch of patterns, but it seems to be impossible to get Process::fake() to match a multi-line command.

Steps To Reproduce

Process::preventStrayProcesses();

Process::fake(['*' => 'faked output']);

$result = Process::run(<<<BASH
git clone --depth 1 \
      --single-branch \
      --branch master \
      git://some-url .
BASH);
@driesvints
Copy link
Member

Hi @SjorsO. Appreciate the report but this seems like something that's just not possible at the time. If you could send in a PR to make this possible we'd appreciate a PR. Make sure to add tests. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants