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

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 ...

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