Unit Testing Magento: What to Expect

Here’s a quick tip when testing with PHPUnit, perhaps when using the excellent framework from EcomDev.  If a test relies on Magento’s translation, “__()” function, then be aware it won’t function unless you initialize it first.  Add this function to your test case class:

    public static function setUpBeforeClass()
    {
        Mage::app()->getTranslator()->init('frontend');
    }