EcomDev_PHPUnit
EcomDev_PHPUnit copied to clipboard
Mocking does not work on magic methods
Varien_Object has magic methods to get and set data. Mocking this does not seem to work:
$templateText = md5(uniqid());
$coreEmailTemplateMock = $this->getModelMock('core/email_template');
$coreEmailTemplateMock->expects($this->any())->method('getTemplateText')->will($this->returnValue($templateText));
$this->replaceByMock('model', 'core/email_template', $coreEmailTemplateMock);
$this->assertEquals($templateText, Mage::getModel('core/email_template')->getTemplateText());
while the same with the existent "isEmpty" as method does work