1

I would like to know if there is a way unit test templates using Craft 2.5? For example trying to prevent null pointers happening in production when an image is remove from the entry

2
  • 1
    I'm not sure how you would unit test templates, probably it could be done, but you might be better served by coding defensively, as per Handling Errors Gracefully in Craft CMS Nov 27 '18 at 23:16
  • I'll second Andrew's suggestion as a better approach. Outside of that, the front-end templates of a site are generally tested with acceptance or integration testing instead of unit testing.
    – Brad Bell
    Nov 28 '18 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.