0
votes

My Current PHP version: 7.1.28

My PHPUnit 7.5.9 by Sebastian Bergmann and contributors.

PHPUnit installed with PHP Archive (PHAR)

➜ wget -O phpunit https://phar.phpunit.de/phpunit-7.phar

➜ chmod +x phpunit

➜ ./phpunit --version

but after installing PHPUnit with PHAR it isn't generate "src/autoload.php" but just only file phpunit

but if I run ./phpunit --version in terminal it's show PHPUnit 7.5.9 by Sebastian Bergmann and contributors.

I download the zip in https://github.com/bigmlcom/bigml-php and extract it then I run it bigml-php-master/tests/test_00_regressions.php then I got an error message PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found

can anybody help me please

1
I normally have extends TestCase and use PHPUnit\Framework\TestCase;, not sure if this is part of the stuff you've downloaded.Nigel Ren
If I use extends TestCase; use PHPUnit\Framework\TestCase; got an error syntax error, unexpected 'extends' (T_EXTENDS), expecting end of fileFian Julio
If you show the line giving you the problem it should be easy to fix.Nigel Ren
The class PHPUnit_Framework_TestCase is not in Phpunit 7 any longer (gone with Phpunit 6.5 IIRC). You can try to alias it to PHPUnit\Framework\TestCase but then you might run into additional problems. Check what @Nobu suggested, just to use a compatible version of Phpunit (the version he picked sounds reasonable to me). This should work out of the box.hakre
And please don't forget to close your reported issue on Github: github.com/bigmlcom/bigml-php/issues/37 - This is not a problem with the project, it's just an incompatible Phpunit version you are using.hakre

1 Answers

1
votes

Apparently bigml-php's README doesn't specify which version of phpunit should be used, though it's probably 5.x while the test class extends old class name PHPUnit_Framework_TestCase.

You can still download phpunit-5.7.27.phar. And it seems it's working:

./phpunit-5.7.27.phar test_00_regressions.php