Albertopeinado's avatar

Test fails when running phpunit globally, works when executed alone

So basically if I use the phpunit command to execute the test, I get this error:

There was 1 error:

  1. Tests\Feature\ViewMoviesTest::the_main_page_shows_correct_info Error: Call to undefined function GuzzleHttp_idn_uri_convert()

If I execute it in PHPStorm with the Run 'the_main_page_shows..' it passes correctly. I have no clue why this is happening, in other projects this worked perfectly.

This is my test, it really doesnt do much.

/** @test */
public function the_main_page_shows_correct_info()
{
    $this->withoutExceptionHandling();

    $response = $this->get(route('movies.index'));
    $response->assertSuccessful();
}
0 likes
3 replies
bugsysha's avatar

How do you use it?

$this->withoutExceptionHandling();

You should remove this from your tests.

Albertopeinado's avatar
Albertopeinado
OP
Best Answer
Level 4

I already solved the problem, this is the issue on github where they address this problem.

https://github.com/guzzle/guzzle/issues/2511

Basically it's a conflict with the composer global dependencies. While I had guzzle v6.5.2 on my local composer.json, in global composer I had v6.3.3. That caused the conflict and made it fail.

I just run 'composer global update' and everything got solved.

This question can be closed! Thanks

Please or to participate in this conversation.