Developers/Order plugins/Implementation/Unit test

The unit test should perform some actions and compare the result with the expected output. You can define unit test data your tests should run with, i.e. write some test data to table mshop_plugin with editing lib/arcavias-core/lib/mshoplib/setup/unittest/data/plugin.php. The setup task PluginAddTestData takes care of writing these values into the database when phing setup is executed.

Writing tests for both methods register and update is recommended. Try passing right and wrong data types to the methods and test all scenarios for update where the plugin should return true, false or throw an exception. Take a look at the tests for built in plugins in lib/mshoplib/tests/MShop/Plugin/Provider/Order or read more on how to write unit tests in Arcavias.

<< Previous: Plugin provider decorators