NativePHP
📲  Join the NativePHP for mobile Early Access Program →

Child Process


NativePHP is currently in beta

Let's get to v1!

#Fake Child Processes

#Example test case

Copied!
use Native\Laravel\Facades\ChildProcess;
 
#[\PHPUnit\Framework\Attributes\Test]
public function example(): void
{
ChildProcess::fake();
 
$this->get('/whatever-action');
 
ChildProcess::assertGet('background-worker');
ChildProcess::assertMessage(fn (string $message, string|null $alias) => $message === '{"some-payload":"for-the-worker"}' && $alias === null);
}

#Available assertions

  • assertGet
  • assertStarted
  • assertPhp
  • assertArtisan
  • assertStop
  • assertRestart
  • assertMessage