We are going straight to the core of testing in Magento! Let's see how it is done.
Magento offers PHPUnit as a feature for your unit testing development. This tool is a programmer-oriented testing framework based on the xUnit architecture for unit testing frameworks. Magento installed PHPUnit with a composer in [magento_root]/vendor/phpunit
, so you don't have to install PHPUnit yourself.
All of the data tests are located in [magento_root]/dev/tests
, so Magento placed a phpunit.xml
file configuration for each type of test.
These configuration files are used by PHPUnit to know how to run each test. For unit tests, the configuration file is located in [magento_root]/dev/tests/unit
.
Open the [magento_root]/dev/tests/unit/phpunit.xml
file. You can see the <testsuite>
tag and many directories listed in it. PHPUnit will browse your Magento file structure and execute, in these directories, all the files suffixed by Test.php
:
<testsuite name="Magento...