How to use the real object manager for your custom PHPUnit test?

test
object-manager
unit-tests
phpunit
(Dmitry Fedyuk) #1

This code allows to to avoid the «ObjectManager isn’t initialized» issue while running your custom PHPUnit tests.

Please note that I use in this example (and for my Magento 2 extensions) the latest PHPUnit distributive (5.x) instead of the legacy 4.1.0 version used by the Magento 2 core.

You can also use a mock object manager for your custom PHPUnit tests.

0 Likes

How to use a mock object manager for your custom PHPUnit test?
How is ObjectManager initialized?
(Dmitry Fedyuk) #2

See also:

0 Likes