Guides
Test Your Audit Log with Waypoint
Call Waypoint::fake() in your test. Activities are then collected in memory and you can assert them without touching the database.
php
use Waypoint\Facades\Waypoint;
public function test_paying_an_invoice_is_logged(): void
{
Waypoint::fake();
$this->actingAs($user)->post("/invoices/{$invoice->id}/pay");
Waypoint::assertLogged('updated', $invoice);
Waypoint::assertLoggedCount(1);
}
Available assertions
Assertion
Description
assertLogged($event, $subject)An activity for the event and subject was written
assertNotLogged($event, $subject)No such activity was written
assertLoggedCount($count)Exactly this many activities were written
assertNothingLogged()No activity was written at all
Last updated: