6

Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?

6

Yes it is possible, see this example plugin by Selvin Ortiz: https://github.com/selvinortiz/craft.loath.

You can also check out https://github.com/boboldehampsink/import for some detailed unit tests.

| improve this answer | |
  • Excellent, thanks Bob, this is exactly what I was looking for! – Lindsey D Sep 4 '14 at 20:33
  • 1
    That plugin uses: /craft/app/vendor/phpunit/phpunit/phpunit.php, /craft/app/tests/bootstrap.php, and /craft/app/tests/phpunit.xml which doesn't ship in the latest version of Craft 2 anyone. – Maarten de Graaf Sep 29 '17 at 11:57
  • True. I still provide these files myself for now and I'm not sure what Craft's future philosophy on testing will be. – Bob Olde Hampsink Oct 3 '17 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.