O'Reilly logo

Magento 2 Developer's Guide by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit testing

Unit tests are designed to test individual class methods in isolation, asserting all possible combinations and taking care of the smallest testable part of an application. Magento uses the PHPUnit testing framework for its unit tests. Being highly focused, unit tests make it easy to identify the root cause of issues if a certain test fails.

We can specifically trigger the unit tests from the root of the Magento installation by using the following command:

php bin/magento dev:tests:run unit

Once triggered, Magento will run the execute command in the vendor/magento/module-developer/Console/Command/DevTestsRunCommand.php file. Since the unit type is mapped to several commands, what will happen internally is that Magento will change the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required