Static testing

Static tests do not really run the code; they analyze it. They are used to verify that the code conforms to certain coding standards, such as PSR-1. We can find them under the dev/tests/static directory.

To specifically trigger static tests only, we can execute the following command on the console:

php bin/magento dev:tests:run static

When executed, Magento internally changes the directory to dev/tests/static and executes a command that is similar to the following one:

php /Users/branko/www/magento2/./vendor/phpunit/phpunit/phpunit

The static directory has its own phpunit.xml.dist file. Looking at its testsuite definition, you will see the following four test suites defined:

  • JavaScript static code analysis
  • PHP coding standard verification ...

Get Magento 2 Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.