A quick primer on running Magento 2’s development tests. Most of this is just reworded information from Vinai Kopp guiding me through.
If you’re working with the Magento 2 GitHub repository, you can run the project’s unit tests with
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml
This assumes you’ve copied
phpunit.xml file contains is PHP Unit’s configuration file, which helps test harness developers initialize their testing enviornment. You may need to use this configuration file to set certain PHP
ini flags (
memory_limits, etc) if your defaults clash with what Magento needs.
You can also run Magento 2’s integration tests. Per Wikipedia, integration testing is
Integration testing (sometimes called integration and testing, abbreviated I&T) is the phase in software testing in which individual software modules are combined and tested as a group.
In the web application MVC world, integration test has become synonymous with
tests that require a bootstrapped Magento enviornment to run
In order to run Magento’s integration tests, you need to point the unit testing framework at a MySQL server, and a specific database on this server. You should not use your own development schema for this, as the integration suite will end up modifying the database while running.
To point the test framework at your database, copy
and add your credentials to this file. The integration suite also has its own PHP Unit configuration file
which you’ll want to copy to
and make any needed changes (PHP
ini memory limits, etc)
Finally, to run the integration tests, you’ll need to change to the integration test directory, and run PHP unit from there
$ cd dev/tests/integration $ ../../../vendor/bin/phpunit
Trying to run the integration tests from a different directory (i.e. the root directory) can lead to problems with
dev/tests/integration/phpunit.xml is not readable errors.