Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Setting Up Your Module

IvanChepurnyi edited this page Dec 9, 2011 · 2 revisions

Setting Up Your Module For letting system know that your module contains unit tests you just need to add few lines into your module config.xml file:

<phpunit>
    <suite>
         <modules>
             <Your_ModuleName />
         </modules>
    </suite>
</phpunit>

Than you need to create Test directory in your module that will be used for searching of the test files. This directory can contain such sub-directories that are also test groups:

  • Model for test cases related to models
  • Block for test cases related to blocks that can be tested in isolation
  • Helper for test cases related to helpers
  • Controller for test cases related to controller actions together with layout and blocks
  • Config for test cases related to your module configuration file definitions

Your test case class should be named in such a way:

[Your Module]_Test_[Group Directory]_[Related Entity Name]

For instance if you want to test your custom product model in module called “MyCustom_Module” you need to create a test case class with such name:

MyCustom_Module_Test_Model_Product and extended from EcomDev_PHPUnit_Test_Case class Group directories can have as many nested levels as you wish, system collects test case files recursively.

Clone this wiki locally