17 January 2024
Freek
Pest comes with Ray integration out of the box
Pest is an excellent test runner for PHP, that’s been getting more popular. It offers a developer friendly way of writing tests. At Spatie, we use it for all our projects.
Did you know that Pest comes with Ray support out of the box?
Let’s take a look at this very simple test from one of our own packages.
it('can get all holidays of the current year', function () {
$holidays = Holidays::for(Belgium::make())->get();
expect($holidays)->toBeArray();
});
Imagine now that you want to send the content of $holidays
to Ray. Well, thanks to Pest’s integration with Ray, you can just chain a ray()
call after expect
like this.
it('can get all holidays of the current year', function () {
$holidays = Holidays::for(Belgium::make())->get();
expect($holidays)->ray()->toBeArray();
});
Pretty sweet! Only a couple of keystrokes are needed to send something to Ray!
Understand and fix bugs faster
Ray is a desktop application that serves as the dedicated home for debugging output. Send, format and filter debug information from both local projects and remote servers.