From 393e0c0b6ab25f57d1f5e2d02587d80de0f03e4d Mon Sep 17 00:00:00 2001
From: Grzegorz Rola <grola@seostudio.pl>
Date: Thu, 9 Jun 2022 12:52:05 +0000
Subject: [PATCH] Feature/readme

---
 README.md                             | 24 ++++++++++++++++++++++++
 tests/integration/TestAjaxHandler.php |  3 +++
 2 files changed, 27 insertions(+)

diff --git a/README.md b/README.md
index efcff27..492f916 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 f930d5c..2f7ee00 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;
 
-- 
GitLab