Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

360
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda