diff --git a/tests/integration/TestPermanentDismissinleNotice.php b/tests/integration/TestPermanentDismissinleNotice.php index 82fda69a1a1b8c9a6c050e9daa587bdd47997dd2..2a403359a2b0bc2bc7b5a1ae8dc35576a546f699 100644 --- a/tests/integration/TestPermanentDismissinleNotice.php +++ b/tests/integration/TestPermanentDismissinleNotice.php @@ -5,6 +5,8 @@ use \WPDesk\Notice\PermanentDismissibleNotice; class TestPermanentDismissinleNotice extends WP_UnitTestCase { + const NOTICE_NAME = 'test_notice_name'; + public function testAddAction() { $notice_priority = 11; @@ -19,6 +21,23 @@ class TestPermanentDismissinleNotice extends WP_UnitTestCase $this->assertEquals($notice_priority, has_action('admin_notices', [$notice, 'showNotice'], $notice_priority)); } + public function testUndoDismiss() + { + update_option(PermanentDismissibleNotice::OPTION_NAME_PREFIX . self::NOTICE_NAME, PermanentDismissibleNotice::OPTION_VALUE_DISMISSED); + + $notice = new PermanentDismissibleNotice( + PermanentDismissibleNotice::NOTICE_TYPE_INFO, + 'test', + self::NOTICE_NAME + ); + $notice->undoDismiss(); + + $this->assertEquals( + '', + get_option(PermanentDismissibleNotice::OPTION_NAME_PREFIX . self::NOTICE_NAME, '') + ); + } + public function testShowNotice() { $notice = new PermanentDismissibleNotice(