nikkisix's avatar

How to feature test Cache Lock Laravel

I'm working using Laravel's cache lock and I'm doing a test manually using 2 browsers to make sure if within 10 seconds the first process hasn't finished, then the second process will get a response abort status code 429, and this works as expected, but I'm confused about how to do a feature test for this case. This code that i want to test.

Cache::lock('lock-payment')->block(10 , function() 
use($pricing_order , $data_order , $vaNumber , $vaPayment , &$message)
{  
   sleep(11) 
  //another action
});


} catch (LockTimeoutException $e) {
    return $e->failed();
}
0 likes
0 replies

Please or to participate in this conversation.