Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Stub: returns fixed response $payment = $this->createStub(PaymentGateway::class); $payment->method("charge")->willReturn(["status" => "ok", "id" => "ch_123"]); // Spy (PHPUnit mock that checks after the fact) $mailer = $this->createMock(Mailer::class); $mailer->expects($this->exactly(2))->method("send"); // Laravel fakes (built-in) Mail::fake(); Queue::fake(); Storage::fake("public"); Http::fake(); Mail::assertSent(OrderConfirmation::class);
Result
Open