Today is my first day using PHPUnit, I've installed phpunit6.1, php7.1 and trying to write simple assertEquals test. When I extend my test class with \PHPUnit\Framework\TestCase - everything works nice, but I can't create an object because \Magento\Framework\TestFramework\Unit\Helper\ObjectManager requires \PHPUnit_Framework_TestCase object, not \PHPUnit\Framework\TestCase. When I extend my class with \PHPUnit_Framework_TestCase - phpunit just skip this test.

How to fix that?

Magento version: 2.1.4

1 Answer 1


If you want to use the Magento testing framework, you have to stick with PHPUnit 5.x where the old class names are still used.

The core tests even run on PHPUnit 4.1 (see composer.json), but in my experience, you can create your own tests in PHPUnit 5.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.