diff --git a/includes/class-controller.php b/includes/class-controller.php index 672dd1d..f0ee703 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -27,6 +27,8 @@ public function __construct() { /** * Enable API Rewrites based on the Users settings. * + * @codeCoverageIgnore Side-effects are from other methods already covered by tests. + * * @return void */ private function api_rewrite() { @@ -52,6 +54,8 @@ private function api_rewrite() { /** * Ajax action to clear the Log file. * + * @codeCoverageIgnore Cannot be tested. Results in script termination. + * * @return void */ public function clear_log() { @@ -82,6 +86,8 @@ public function clear_log() { /** * Ajax action to read the Log file. * + * @codeCoverageIgnore Cannot be tested. Results in script termination. + * * @return void */ public function read_log() { diff --git a/tests/phpunit/tests/Controller/Controller_ConstructTest.php b/tests/phpunit/tests/Controller/Controller_ConstructTest.php new file mode 100644 index 0000000..c1eb0dd --- /dev/null +++ b/tests/phpunit/tests/Controller/Controller_ConstructTest.php @@ -0,0 +1,44 @@ +assertIsInt( has_action( $hook, [ $controller, $method ] ) ); + } + + /** + * Data provider. + * + * @return array[] + */ + public function data_hooks_and_methods() { + return [ + 'wp_ajax_aspireupdate_clear_log -> clear_log' => [ + 'hook' => 'wp_ajax_aspireupdate_clear_log', + 'method' => 'clear_log', + ], + 'wp_ajax_aspireupdate_read_log -> read_log' => [ + 'hook' => 'wp_ajax_aspireupdate_read_log', + 'method' => 'read_log', + ], + ]; + } +}