Summer Sale! All accounts are 50% off this week.

keizah7's avatar
Level 17

Ray not work in tests

I'm using ray and it works everywhere except tests. Where problem can be? https://spatie.be/docs/ray/v1/introduction

/** @test */
function user_can_create_translatable_category()
{
    ray('test');

    $this->assertTrue(true);
}
0 likes
2 replies
keizah7's avatar
keizah7
OP
Best Answer
Level 17

I am using sail in my project.

ray.php settings for sail

RAY_HOST=host.docker.internal

ray settings for testing phpunit.xml

<server name="RAY_HOST" value="127.0.0.1"/>
1 like
Daniel-Pablo's avatar

-JUST ADDING MORE INFO TO THIS THREAD- Thanks for the previous helps me fix my issue

Hi I run into the same issue the way it works for me was following this guide of installation for SAIL

In the installation process, you got to specify that this will work with docker so you pull up the --docker flag

php artisan ray:publish-config --docker

https://spatie.be/docs/ray/v1/installation-in-your-project/laravel

this is an extra info just if you want to see it https://spatie.be/docs/ray/v1/environment-specific-configuration/docker

FOR Testing with ray and PHPUnit and pest- add the following to PHPUnit.xml file:

<server name="RAY_HOST" value="host.docker.internal"/>

Just in case some one runs into the same

Please or to participate in this conversation.