Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JohnnyBigodes's avatar

Tests pass on console, but fail on IDE

Hello everyone,

I am having a problem and it seems that I cant solve it.

I am writing simple tests for an API and these pass with PHPUnit without a problem on my console, but not on my IDE.

Am I missing something?

Here is my test:

<?php

namespace Tests\Feature;

use Tests\TestCase;

class AddressesHTTPTest extends TestCase
{
   protected function setUp(): void
    {
        parent::setUp();
    }

    /** @test */
    public function can_get_all_addresses()
    {
        $response = $this->withHeaders([
            'Accept' => 'application/json',
            'Authorization' => 'Bearer 456987sdfsdeasaASDASD',
        ])->json('GET', '/api/addresses');

        $response->assertStatus(200);
    }
}


Here is the output of my IDE:

Testing started at 11:30 ...
C:\laragon\bin\php\php-7.3.12-Win32-VC15-x64\php.exe C:/laragon/www/_PHP/LEI-API-Frontend/vendor/phpunit/phpunit/phpunit --configuration C:\laragon\www\_PHP\LEI-API-Frontend\phpunit.xml --filter "/(Tests\Feature\AddressesHTTPTest::can_get_all_addresses)( .*)?$/" --test-suffix AddressesHTTPTest.php C:\laragon\www\_PHP\LEI-API-Frontend\tests\Feature --teamcity
PHPUnit 8.5.5 by Sebastian Bergmann and contributors.


Expected status code 200 but received 500.
Failed asserting that false is true.
 C:\laragon\www\_PHP\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:185
 C:\laragon\www\_PHP\LEI-API-Frontend\tests\Feature\AddressesHTTPTest.php:17
 


Time: 392 ms, Memory: 22.00 MB


FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Process finished with exit code 1

And here the output on my console:

PHPUnit 8.5.5 by Sebastian Bergmann and contributors.

..                                                                  2 / 2 (100%)

Time: 431 ms, Memory: 20.00 MB

OK (2 tests, 2 assertions)
0 likes
3 replies
aleahy's avatar

You're getting a 500 error which suggests the code is failing somewhere.

If you put this in your test:

$this->withoutExceptionHandling();

$reponse = ...

then it will stop wherever the code fails and you might be able to sort out the issue.

JohnnyBigodes's avatar

@aleahy

Ok, it seems I am getting this error: Symfony\Component\Debug\Exception\FatalThrowableError : Class 'Redis' not found

In my .env file I have the following; CACHE_DRIVER=redis

Dont know how I will have to fix that.

But does it pass on console but not in my IDE?

EDIT: Found out that I had the wrong PHP version in my IDE. Just changed to the version where Redis is installed and now everything works as intended.

Thanks for the help

Please or to participate in this conversation.