Back to overview

Pest comes with Ray integration out of the box

17 January 2024

Image of Freek

Freek

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!

Stay in the loop with updates & promotions for Ray

We only send a few emails a year.

Debug without breaking your flow

Ray keeps all your debug output neatly organized in a dedicated desktop app.

Licenses are valid for 1 year and managed through Spatie. Licenses purchased before Ray 3 remain valid. VAT is calculated at checkout.