Make changes to the database during a Livewire Pest chain
A nice use case for tap
Read more [stefrouschop.nl]
Posts tagged with testing
A nice use case for tap
Read more [stefrouschop.nl]
Here's how you can make sure that all implementations of an interface behave correctly
Read more [www.kai-sassnowski.com]
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
Let's take a look at the different ways to generate a random number in PHP.
Read more [php.watch]
– doeken.org - submitted by Doeke Norg
It's time to replace your mocked event dispatchers with a real one.
Read more [doeken.org]
– tighten.com - submitted by Jamison Valenta
If you're running a Laravel application in the 5's, have a legacy application bootstrapped inside Laravel, don't have any tests, or are staring in silent terror at just how long ago your production server's PHP version hit its end-of-life, this post is for you!
Read more [tighten.com]
– stefanzweifel.io - submitted by Stefan Zweifel
Ever needed to work with an SDK and wished you could use Http::fake() in your Laravel tests?
This blog post explains how you can achieve this for the Facebook Business SDK using the Adapter pattern.
Read more [stefanzweifel.io]
A cool new package made by Luke Downing
Read more [downing.tech]
– www.juststeveking.uk - submitted by Steve McDougall
I get asked about API response testing a lot, how should you do it, and where to start. I have a general rule when it comes to testing APIs, and that rule is: "test your code, and your code only". What do I mean by this? Let me explain:
Read more [www.juststeveking.uk]
A couple of months I go I had the honour giving a talk at the GPUG usergroup on how to convert a PHPUnit testsuite to Pest.
Nowadays, I use Pest as the default testrunner for every package / project that I start.
– barryvanveen.nl - submitted by Barry van Veen
I made a script to easily take consistent measurements using Apache Benchmark. It includes an easy way to compare multiple measurements in a visual way.
Read more [barryvanveen.nl]
Getting started with testing is not that hard. Here's a free video taken from the Testing Laravel course that will show you how you can make sure you homepage works.
Read more [spatie.be]
– rias.be
One of our projects has a really large test suite that isn't optimised to run with Laravel's parallel testing. It was starting to take more than 15 minutes to have the whole test suite run inside Github Actions, which is when my colleague Rias searched for a better way to do this.
Read more [rias.be]
– devonmather.dev - submitted by Devon Mather
Let's explore the option of firing events on model scopes to add some glue between our feature tests and our unit tests.
Read more [devonmather.dev]
Last week, Caleb tweeted about a nifty function called invade - that he had made to easily work with private properties and methods.
😈 Whatcha think of my new favorite helper method?
— Caleb Porzio (@calebporzio) February 11, 2022
That property/method protected or private? No problemoooo 🔓 pic.twitter.com/HqMXKKpRsJ
He added that invade function to Livewire. Because I could see myself using this in non-Laravel projects, I packaged up the function in a new package called spatie/invade.
Last year, Laracon held another online edition in the summer. All of the videos are now publicly viewable. You'll find them in this playlist on YouTube.
I had the honour of doing a short talk on snapshot testing in PHP, which you can watch below.
Here's how Luke Downing goes about testing environment specific things.
Read more [downing.tech]
In this video, Michael steps a natural approache on how to test environment specific functionality.
I've used this little bash alias for many years to quickly run the tests inside of a project.
alias p="vendor/bin/phpunit"
With this alias in place, I can run the tests by typing "p" on the CLI. Nice!
For a long time, everything was great! But then, Pest appeared on the scene. It's an alternative test runner for PHP with a high focus on developer experience.
In your tests, you might have used assertDatabaseHas to make sure that a model actual is persisted.
Have you ever had to write an API integration from scratch? Where you're managing the HTTP calls yourself instead of being able to rely on third-party packages?