Even if you do not have access or choose not to use the Sugar 7 PHPUnit framework, readers should still find the concepts covered in this post useful for testing Sugar 7 code.
Testing a Logic Hook
We will start with a realistic code customization so we can create a useful example of some unit tests. There are a variety of server-side code customizations that are possible within Sugar 7 but perhaps the most common example would be the Logic Hook. If you’ve done any significant amount of development on Sugar then you’ve like likely written more than one logic hook. Sugar logic hooks have been an important tool in the Sugar Developer’s toolbox since well before the release of Sugar 7. So this is a very appropriate example for us to use.