MageSpec Update

Posted July 27, 2014

MageSpec Update

This week MageSpec received a massive update. This update enabled features that we have wanted for a long time.

These updates will make testing Magento with PHPSpec a lot easier and reduce the steps required to setup and module. The updates are:

  • Support for Magento Code pools
  • Automatic Module code generation.

So what does all this mean ? Well previously MageSpec only supported specing of modules within the “local” code pool. Now with a simple modification to the phpspec.yml file you can spec:

  • Local
  • Community
  • Core

If you dont update phpspec.yml then by default MageSpec will continue to spec files from local, But to specify a different code pool you can do so my adding code_pool: 'pool'

extensions: [MageTest\PhpSpec\MagentoExtension\Extension]
  spec_prefix: 'spec'
  src_path: 'public/app/code'
  spec_path: 'spec/public/app/code'
  code_pool: 'community'

The next update to the module is automatic code generation. By default PHPSpec will generate the Spec files and the class files. For Magento this worked OK but it still required manual steps outside of PHPSpec to transform the code into a valid Magento module. Such as adding a module definition in app/etc/modules/… As well as the modules etc/config.xml with the correct XML node reference for blocks helpers and models.

Now MageSpec knows how and where to place these files. So When you describe any class now and the module does not exist the biolerplate is created to enable the module. Any describes there after will when applicable update the modules config.xml. This is a massive bonus as MageSpec is creating configuration to allow the code to work within Magento.

What are you waiting for ? Update your composer.json to and enjoy the power of code pool support and code generation.

Finally a massive thank you to the 2 contributors that made this possible:

You may also find these related posts interesting: Developer Book Club All hail Xdebug and lets let var dump die A new look and a cleanup of content plus good bye github pages. Docker and Docker Sync