I'm working on trying to refactor an old module someone had built and wanted to have unit tests in place so I could make sure the refactored version was working correctly, so I installed EcomDev_PHPUnit via Magento Connect, added the database and url details to local.xml.phpunit and then added the phpunit entry into the module configuration so it would recognise it as having tests present

The problem is that, when I try to run phpunit in the base directory like the instructions say, it just shows the help prompt phpunit does when you run it without a target. I then tried running it on the Magento directory, but other modules with tests started throwing errors about core classes not being available. The last thing I tried was just running phpunit on the test I'd built, which just had an empty function in it so shouldn't have thrown any errors, but that complained about EcomDev_PHPUnit_Test_Case not being found.

So I'm stuck, it seems like I either can't run any tests or the tests won't import the correct classes from Magento. Does anyone know what might be causing this? I'd really appreciate a bit of help with this


2 Answers 2


When downloading this from, e.g. GitHub, (as opposed to installing via ModMan or composer) there is a phpunit.xml.dist file included in the .zip file that needs to be copied/placed in the Magento root folder as well as the rest of EcomDev. With that file in place, running phpunit will run correctly. I have had the exact same issue as you and have just spent several hours trying to work this out!

This .dist file is the "initial phpunit configuration file, that you can modify for your project needs".

  • Fantastic. Don't need it right now, but it's something I'll be looking more at getting working in the near future, so really appreciate you taking the time to write up an explanation Commented Apr 4, 2016 at 10:31

Closing this off as I found installing it with Modman resolved this issue and is the recommended installation method. Bit odd that it's available for download from Magento Community if that's the case, but there you go

  • Hadn't thought it was necessary since it was me responding to myself. Done now Commented Nov 19, 2014 at 11:09
  • Thanks! It is more clean and especially important for the site statistics: Every answered question is good for us :)
    – Simon
    Commented Nov 19, 2014 at 11:12

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.