Magento2 – Fix PHPUnit_Framework_TestCase Not Found

magento2magento2.2magento2.3magento2.3.0

just made upgrade to 2.3.0 and while compilation get this error:

server@server:~/web/server.dev.company.com/public_html$ /usr/bin/php7.1 bin/magento setup:di:compile
    Compilation was started.
    Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 68.0 MiBPHP Fatal error:  Class 'PHPUnit_Framework_TestCase' not found in /home/server/web/server.dev.company.com/public_html/app/code/WebShopApps/MatrixRate/test/Unit/Block/Adminhtml/Form/Field/ImportTest.php on line 36

I try to remove this module, but it not solve this trouble.

Best Answer

If you're using PHPUnit version 6, please replace class 'PHPUnit_Framework_TestCase' in your test file to 'PHPUnit\Framework\TestCase'. So it'd look like this:

class YourTest extends \PHPUnit\Framework\TestCase {
    ...
}

Reference : https://github.com/magento/magento2/issues/11114

Related Topic