The integration test hook reminder has been executed

I have a little proof of concept plugin that I want to cover with tests. The plugin adds a simple dashboard widget.

get_widget_id (),
$ this-> get_widget_name (),
      [ $this, 'widget_callback' ],
      [ $this, 'widget_control_callback' ],
$ this-> get_widget_callback_args ()
)
}

public function widget_callback () {
echo & # 39;
contents
& # 39 ;; } public service widget_control_callback ($ atts) { return null; } protected function get_widget_id () { return & # 39; widget_name & # 39 ;; } protected function get_widget_name () { returns 'Widget Name'; } protected function get_widget_callback_args () { return []; } } (new Dashboard_Widget) -> register ();

After configuring the integration test suite, I wrote a test that looks like this:

register();

ob_start ();
$ dashboard_widget-> widget_callback ();
$ content = ob_get_clean ();

$ control_callback = $ dashboard_widget-> widget_control_callback ( [] )

$ this-> assertEquals (& # 39;
contents
& # 39 ;, $ content); $ this-> assertNull ($ control_callback); $ this-> assertEquals (10, has_action (& # 39; wp_dashboard_setup & # 39; [ $dashboard_widget, 'add_dashboard_widgets' ] )); } }

The test is successful. The result of the code cover: 33.33%

Percentage coverage
Passthrough cover

As you can see that the reminder is not running, the private methods used in the widget are not passed.

If I try to add

                $ dashboard_widget-> add_dashboard_widgets ();

in my test I will get an undefined function error – because this has to be hooked to wp_dashboard_setup for this to work.

The plugin works (tested by installing it on the wp test). The methods call, the test succeeds.

But how do I test this so that everything is covered?

I miss some of that but I do not know what.

You can find the complete code base here: https://github.com/dingo-d/test-proof-of-concept