Difference between revisions of "Developers/Unit Testing"
From PartKeepr Wiki
(Created page with "= Introduction = Most PartKeepr tests are actually functional tests. = Common Issues = == Fatal error: Call to undefined method PHPUnit_TextUI_TestRunner::printVersionStrin...") |
|||
Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
− | Most PartKeepr tests are actually functional tests. | + | Most PartKeepr tests are actually functional tests. Because we do automated testing using [https://travis-ci.org/partkeepr/PartKeepr Travis CI], you need to specify your test database prior executing phpunit: |
+ | |||
+ | <pre> | ||
+ | # Specifies the database connection to use. Other choices are mysql and pgsql as specified in [https://github.com/partkeepr/PartKeepr/blob/sf2migration/app/config/config_test.yml config_test.yml] | ||
+ | export SYMFONY__TESTDB=sqlite | ||
+ | vendor/bin/phpunit -c app/ | ||
+ | </pre> | ||
= Common Issues = | = Common Issues = | ||
Line 11: | Line 17: | ||
== Unable to find file "@PartKeeprFrontendBundle/Resources/public/js/" == | == Unable to find file "@PartKeeprFrontendBundle/Resources/public/js/" == | ||
− | Sometimes the cache messes up unit tests, as we are doing functional tests. You should [Developers/Re-generating_the_environment|regenerate the environment]. | + | Sometimes the cache messes up unit tests, as we are doing functional tests. You should [[Developers/Re-generating_the_environment|regenerate the environment]]. |
Revision as of 12:24, 10 October 2015
Contents
Introduction
Most PartKeepr tests are actually functional tests. Because we do automated testing using Travis CI, you need to specify your test database prior executing phpunit:
# Specifies the database connection to use. Other choices are mysql and pgsql as specified in [https://github.com/partkeepr/PartKeepr/blob/sf2migration/app/config/config_test.yml config_test.yml] export SYMFONY__TESTDB=sqlite vendor/bin/phpunit -c app/
Common Issues
Fatal error: Call to undefined method PHPUnit_TextUI_TestRunner::printVersionString()
This might happen if you are using a local PHPUnit installation. You should use the phpunit version installed in
vendor/bin/phpunit
Unable to find file "@PartKeeprFrontendBundle/Resources/public/js/"
Sometimes the cache messes up unit tests, as we are doing functional tests. You should regenerate the environment.