Assembling a testable Plugin

I’m trying to up my game a bit.

I’ve recently been working on isolating some of my code into a plugin. This led quickly to the realization that my plugin was now divorced from all the supporting context that made testing possible.

Looking at an example plugin for guidance I see this directory structure:

Makes sense. The plugin is set up like any cake but with a few omitted bits that aren’t relevant to the plugin.

Inside the ‘tests’ folder is another app that is used to provide the necessary context for the plugin.

There are surely many details related to building up all this infrastructure and having it integrate properly.

As a lone wolf coder I can eventually copy/paste, google, and experiment my way into an approximation of a working setup. But is anyone aware of a source of guidance for this process?

I recently wanted to improve testing on a standalone plugin I am mantaining.

This anwser helped me a lot.

The key is setting a dummy app in your tests folder, this allows to even use bin/cake commands