Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

359
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!