4

Sometimes I need to set up config XML attributes for automated testing.

For example:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <global>
        <somenode foo="bar" />
    </global>
</config>

I would like to define this as a fixture as the XML configuration is only needed for executing some tests. Is this possible with EcomDev_PHPUnit?

For now I'm working around the issue by executing this in my setUp method:

Mage::app()->getConfig()->getNode('global/somenode')->addAttribute('foo', 'bar');
2

Try this in a fixture file:

config_xml:
  global: |
     <somenode foo="bar" />
  • I managed to add an attribute like this, thanks. (And don't I don't get it to work now aynmore. No idea why.) I also need to add a child with a value to somenode. I couldn't do it by mixing XML and fixtures, using fixtures only with config: and config_xml: or using fixtures only using config_xml: with nested tags. I guess I'm doing something wrong. Do you know more about it? – Matthias Zeis Jul 10 '14 at 14:07

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.