Wallogit.com
2017 © Pedro Peláez
PHPUnit setup to support integration testing with Elgg.
Simple test configuration to support integration testing in Elgg using PHPUnit. Assumes the default directory structure for Elgg 1.9., (*1)
Install test configuration into your plugin using composer:, (*2)
composer require foogile/elgg-phpunit
There are three default PHPUnit configurations that can be used to run all unit tests, all
integration tests, or all tests. Unit tests are placed in PLUGIN/tests/unit adn integration tests
are placed in PLUGIN/tests/integration. You can modify the Elgg configuration for the test
environment by creating a file named PLUGIN/tests/integration/settings.php., (*3)
You can run custom init code by creating PLUGIN/tests/integration/bootstrap.php and
PLUGIN/tests/unit/bootstrap.php for integration and unit tests, respectively. Additionally,
PLUGIN/tests/bootstrap.php is loaded first for all cases., (*4)
phpunit -c vendor/foogile/elgg-phpunit/phpunit.unit.xml
phpunit -c vendor/foogile/elgg-phpunit/phpunit.integration.unit.xml
phpunit -c vendor/foogile/elgg-phpunit/phpunit.xml
It is included a utility script to install an Elgg test environment. To
initialize the database, specify your database setup in
PLUGIN/tests/integration/settings.php and execute the following
from the root folder of your plugin:, (*5)
php vendor/foogile/elgg-phpunit/install.php