Laravel: When to use Pipelines? How to test them?

Clean and testable code, and even order-free!

Photo by Pawel Czerwinski on Unsplash

When should I use a Pipeline?

  1. Retrieve the Podcast.
  2. Check the payment is enough to subscribe to the Podcast.
  3. Check the User has not already subscribed to the Podcast.
  4. Confirm the payment.
  5. Attach the User to the Podcast through a Subscription pivot table.
  6. Set the time the Subscription will end.
  7. Send an email with the successful subscription information.

Testing a Pipe

Testing the whole Pipeline

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Italo Baeza Cabrera

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor. https://italobc.com