Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

362
Visualizações
PHPUnit does not work when I run the tests on the Laravel framework, I get the error of /usr/bin/php declares an invalid value for PHP_VERSION

I am trying to run my test file, ImportCSVTest.php with the command ./vendor/bin/phpunit --filter=testNoImportFile

but I get the error of

/usr/bin/php declares an invalid value for PHP_VERSION.
This breaks fundamental functionality such as version_compare().
Please use a different PHP interpreter.

My test file, ImportCSVTest.php is as follows

<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Tests\TestCase;

class ImportCSVTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testNoImportFile()
    {
        Storage::fake('products');

        $response = $this->json('POST', '/import', [
            'csv' => UploadedFile::fake()->create('emptyUpload', 0, null)
        ]);

        Storage::disk('products')->assertMissing('emptyUpload');
    }


}

First time I am coming across an error like this, how does one fix this?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

PHPUnit refuses to be run with a PHP interpreter where the value of the PHP_VERSION constant contains an invalid value due to modification made by vendors that ship (binary) distributions of PHP.

7.3.24-(to be removed in future macOS) is such an invalid value. The -(to be removed in future macOS) suffix was added by Apple, who is the vendor of the PHP interpreter binary you use.

Here is a great article that explains the background. Here is the ChangeLog for PHPUnit 8.5.17. Here is the ChangeLog for PHPUnit 9.5.6. These are the first versions of PHPUnit that check for invalid values of PHP_VERSION on startup.

TL;DR: Do not use the PHP interpreter that is shipped by Apple with macOS. Use Homebrew, or similar, instead.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda