Skip to content

Conversation

@yondifon
Copy link
Contributor

Add missing waitUntil method to FakeInvokedProcess

Problem

The FakeInvokedProcess class was missing the waitUntil method that exists in InvokedProcess, causing test failures when using faked processes.

Solution

Added waitUntil method to both the contract interface and FakeInvokedProcess implementation with comprehensive tests.

Example

Before: This would fail with faked processes

//test 
Process::fake([
    'long-process *' => Process::describe()
          ->output('booting')
          ->output('ready')
          ->iterations(2),
]);

// code
$process = Process::start('long-process');
$result = $process->waitUntil(fn($type, $buffer) => str_contains($buffer, 'ready'));

After: Now works perfectly
// Same code now works with faked processes
$this->assertTrue($result->successful());

Benefits

  • Consistent behavior between real and faked processes
  • Enables proper testing of asynchronous process workflows
  • Fully backward compatible

@taylorotwell taylorotwell marked this pull request as draft September 12, 2025 14:34
@yondifon yondifon marked this pull request as ready for review September 20, 2025 18:22
@taylorotwell
Copy link
Member

Why is out hard-coded and it never passes err if it exists?

@taylorotwell taylorotwell marked this pull request as draft September 20, 2025 19:20
@yondifon
Copy link
Contributor Author

Why is out hard-coded and it never passes err if it exists?

totally missed this; thanks. pushed a changed.

@yondifon yondifon marked this pull request as ready for review September 30, 2025 11:03
@taylorotwell
Copy link
Member

What if I invoke waitUntil twice?

@taylorotwell taylorotwell marked this pull request as draft September 30, 2025 11:28
@yondifon
Copy link
Contributor Author

What if I invoke waitUntil twice?

d6ab3b0

here's a commit for tests along with that for wait method too.

@yondifon yondifon marked this pull request as ready for review October 7, 2025 18:00
@taylorotwell taylorotwell merged commit 324903f into laravel:12.x Oct 7, 2025
62 of 63 checks passed
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

Successfully merging this pull request may close these issues.

3 participants