magento2: Class 'PHPUnit\Framework\TestCase' not found when execute UnitTests
Preconditions
- Magento Open Source 2.2
Steps to reproduce
- Install Magento 2.2
- enter Terminal in Document Root of Magento 2.2
- execute
./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist
Expected result
- the tests are running
Actual result
1.Class ‘PHPUnit\Framework\TestCase’ not found in /var/www/htdocs/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php on line 14

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (3 by maintainers)
@jigar48 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:
Looks like you forgot to run
composer install.In
2.2.0PHPUnit version was upgraded to6.xwhich introduced this new class.