Hi I am trying to Run a PHPUnit static test only for the /app folder and I do not know how to exclude the /vendor folder not to be tested.

I am using the following command: php vendor/phpunit/phpunit/phpunit -c dev/tests/static/phpunit.xml

If somebody has any idea on how to exclude the /vendor folder and run the static test only in for the /app folder, your help will be much appreciated.

  • you can't exclude vendor folder in this scenario. since under vendor folder, it holds some of the basic definitions which is required by a module to be run.
    – John
    Oct 17, 2018 at 7:17
  • Thank you John. This clarifies everything. I am a beginner with Magento 2 and I thought that I could run a "PHP Coding Standard Verification " test to verify the code written in the /app folder.
    – Costin
    Oct 17, 2018 at 7:26

1 Answer 1


you can do by run following command to test your own module

1) Go to your Magento root folder

2) run below command

./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Vendor/Module

gte reference from here

you can follow below command to run the specific module of vendor directory

./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist vendor/magento/module-catalog

  • This will not gonna fit for static tests - the main point that we do not need filter by tests to be executed, but files that should be covered for these tests.
    – vpodorozh
    Nov 20, 2018 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.