Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mabumusa's avatar

Testing booted method - Best Practice

I am using Laravel Cashier with Stripe, and I am trying to cover the following lines in my tests, so far I tried mocking but that did not work, I was wondering what is the best practice to test them

use function Illuminate\Events\queueable;

/**
* The "booted" method of the model.
*
* @return void
*/
protected static function booted()
{
   static::updated(queueable(function ($customer) {
       if ($customer->hasStripeId()) {
           $customer->syncStripeCustomerDetails();
       }
   }));
}

Thank you for your help

0 likes
2 replies

Please or to participate in this conversation.