diff --git a/README.md b/README.md index efcff27048a628c0ef3dc84ea5fc62f4ab944219..492f91698446d80d6fa12f8e0eaccf13e535a045 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,27 @@ wpdesk_permanent_dismissible_wp_notice( 'Notice text goes here', 'notice-name' ) // Is equivalent to $notice = new \WPDesk\Notice\PermanentDismissibleNotice( 'Notice text goes here', 'notice-name' ); ``` + +## Project documentation + +### AJAX handler + +To use permanent dismissible notices AJAX handler must be created and hooks initialized: + +```php +wpdesk_init_wp_notice_ajax_handler(); + +// Is equivalent to: +( new \WPDesk\Notice\AjaxHandler() )->hooks(); +``` + +### Displaying + +To display permanent dismissible notice: + +```php +wpdesk_permanent_dismissible_wp_notice( 'Notice text goes here', 'notice-name' ); + +// Is equivalent to +$notice = new \WPDesk\Notice\PermanentDismissibleNotice( 'Notice text goes here', 'notice-name' ); +``` diff --git a/tests/integration/TestAjaxHandler.php b/tests/integration/TestAjaxHandler.php index f930d5c566eb79c8e01eddf68fe381b70631cc53..2f7ee0001fa3392851ca8d76d9c10f9b81cd3a35 100644 --- a/tests/integration/TestAjaxHandler.php +++ b/tests/integration/TestAjaxHandler.php @@ -44,6 +44,9 @@ class TestAjaxHandler extends WP_UnitTestCase { $ajaxHandler = new AjaxHandler(self::ASSETS_URL); $ajaxHandler->hooks(); + global $current_screen; + $current_screen = new stdClass(); + $current_screen->id = 'test'; do_action('admin_enqueue_scripts'); $registeredScripts = wp_scripts()->registered;