2

Here is described old version: http://www.ecomdev.org/2011/02/01/phpunit-and-magento-yes-you-can.html

And they wrote that I need call phpunit UnitTests.php

But I have magento v.1.7. I downloaded newest version: https://github.com/IvanChepurnyi/EcomDev_PHPUnit

But there are not any files like UnitTests.php

How I should run unit test then?

2 Answers 2

6

I think this is the neewst available documentation: http://www.ecomdev.org/wp-content/uploads/2011/05/EcomDev_PHPUnit-0.2.0-Manual.pdf

In the current version EcomDev_PHPUnit ships with a phpunit.xml.dist. Rename this one to phpunit.xml, make modifications if necessary and then simply execute phpunit without parameters.

5
  • For some reason I got an error then: Fatal error: Uncaught exception 'Exception' with message 'Warning: include(PHP/Invoker.php)'
    – Anthony
    Commented May 14, 2013 at 8:07
  • Looks like you hit a problem with unit testing Magento. Can you install the PHPunit php-invoker package? Maybe this is related: github.com/sebastianbergmann/phpunit/pull/754
    – Alex
    Commented May 14, 2013 at 8:14
  • thanks for your help! Phpunit works, I just installed another packages. But phpunit still has an error: codepad.org/k7lmQucJ. (I didn't create any test for a while) What is the problem colud be here?
    – Anthony
    Commented May 14, 2013 at 14:25
  • Okay - that is one of the tests which are integrated in EcomDev itself that fails. But having a look at the line github.com/EcomDev/EcomDev_PHPUnit/blob/master/app/code/… it seems that EcomDev can not load the matching expection file from github.com/EcomDev/EcomDev_PHPUnit/blob/master/app/code/…. (Expected is empty, but actual has data)
    – Alex
    Commented May 14, 2013 at 16:30
  • The key here is to run "phpunit" at the main folder, not at /shell. You usually follow the steps in the example, but they simply doesn't tell you to go back to main path. :) Commented Dec 8, 2015 at 11:25
6

there is no need. just run phpunit it wil find the phpunit.xml.dist(as fallback) automatically and use the configuration in this file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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