0

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

5
  • I normally have extends TestCase and use PHPUnit\Framework\TestCase;, not sure if this is part of the stuff you've downloaded. Commented May 4, 2019 at 6:53
  • If I use extends TestCase; use PHPUnit\Framework\TestCase; got an error syntax error, unexpected 'extends' (T_EXTENDS), expecting end of file Commented May 4, 2019 at 8:04
  • If you show the line giving you the problem it should be easy to fix. Commented May 4, 2019 at 8:45
  • 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. Commented Jun 2, 2019 at 15:13
  • 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. Commented Jun 2, 2019 at 15:14

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

Phpunit 5 should be compatible at least, sounds like a good suggestion to me.
0

Latest method:

use PHPUnit\Framework\TestCase;

class SampleTest extends TestCase
{

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.