From 7f333b2effbc16cc97975362c1759ea0c478430a Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Wed, 26 Sep 2018 21:32:51 +0200 Subject: [PATCH] More tests. --- .../TestPermanentDismissinleNotice.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/integration/TestPermanentDismissinleNotice.php b/tests/integration/TestPermanentDismissinleNotice.php index 82fda69..2a40335 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( -- GitLab