Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Innomatic supports unit testing with PHPUnit and provides a preconfigured phpunit.xml configuration file.

To test Innomatic code, PHPUnit must be launched inside the “innomatic” directory of an installed Innomatic instance:

cd innomatic
phpunit

The same applies for Innomatic applications, that must be deployed inside a working Innomatic installation before running the test suite (you cannot run the tests inside the sources folder).

Developing unit tests

Applications can add PHPUnit tests using the the unittest component component.

Test files should be added inside a tests subdirectory inside the tested class folder, e.g.:

Code Block
innomatic/core/classes/innomatic/core/InnomaticSettings.php

...


innomatic/core/classes/innomatic/core/tests/InnomaticSettingsTest.php

Example definition in application.xml file:

Code Block
languagexml
<class name="innomatic/core/InnomaticSettings.php" />

...


<unittest name="innomatic/core/tests/InnomaticSettingsTest.php" />

To test Innomatic code, PHPUnit must be launched inside the “innomatic” directory of an installed Innomatic instance:

Code Block
cd innomatic
phpunit 

Limitations

Innomatic applications to be tested must be deployed inside a working Innomatic installation before running the test suite (you cannot run the tests inside the sources folder).

Please note that as of Innomatic 6.4.x unit testing support is experimental; there are no such facilities like automatic generation of test databases, etc.