Extension unit testing
Pre-requests
- Install vanilla Magento CE 1.9 with magento_sample_data_for_1.9.1.0
- Install extension and switch to correct branch (currently
phpunit for 2.0, 2.1.0 for 2.0+)
How to run
- Install phpunit v4.8.x or later.
Get it from https://phpunit.de/, and include it in your path: mv phpunit.phar /usr/local/bin/phpunit - Copy file
app/etc/local.xml.phpunit.templateintoapp/etc/local.xml.phpunitand edit the file (fields: dbname, secure_base_url, unsecure_base_url)
Same DB has to be configured in both local.xml and local.xml.phpunit Run
cd /magento_root/ # run all tests phpunit # run with debug info, will show all test parameters phpunit --debug # include HTML report in the local.dev/report/index.html phpunit --coverage-html report # run through XDebug, and debug your tests in the IDE (works for PhpStorm 10) export XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9000 remote_host=127.0.0.1 remote_connect_back=0" phpunit # disable XDebug export XDEBUG_CONFIG=""
Expected result:
$ phpunit PHPUnit 4.7.6 by Sebastian Bergmann and contributors. .................. Time: 7.9 seconds, Memory: 54.50Mb OK (18 tests, 18 assertions)
How to add test for:
No comments to display
No comments to display