In Magento 2 documentation "Running Unit Tests in the CLI" is text:
To run all tests, navigate to the Magento base directory and execute the following command:
$ ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist
My question is: How can I run unit tests or integration tests without navigating to specific Magento directory?
So basically I would like to know the reason, why I have to be in specific directory to run phpunit commands in CLI? (I want to execute the command from any location)
EDITED:
Why I can not use full path to the vendor/bin/phpunit directory?
<path to Magento base directory>/vendor/bin/phpunit -c dev/tests/unit/phpunit.xml
ERROR THAT IT RETURNS: Could not read "dev/tests/unit/phpunit.xml". Why the error appears?
Example: why I can not run /var/www/magento2/vendor/bin/phpunit -c dev/tests/unit/phpunit.xml
when I am situated in /var/www/magento2/var/log $
location or anywhere else in the file system?
Reason: I want to create an app that allows me to speed up my development process. (I am not interested IDE-s) and I want to understand the reason why I have to navigate to the Magento base directory.