Skip to content
Snippets Groups Projects
Select Git revision
  • 74b19ccb52144e39e9bdc48530932b10d0e00902
  • master default protected
  • feat/npm-publish
  • feat/demo-deploy
  • change-demo-deploy
  • remove-smoke
  • feat/acceptance-tests
  • feature/deploy-composer.json
  • feature/mysql-bin-logs
  • skip-codecept-for-libs
  • include-composer-json
  • exclude-wp-assets
  • update_codecept_image
  • fix/silenced-copy
  • remove-free-translations
  • codeception-with-optional-step
  • improve-parallelization
  • linter-exit
  • change-images
  • fix/linter
  • globally-raise-mem-limit
  • no-symlink2
22 results

gitlab-ci-free.yml

Blame
  • TestFunctions.php 3.01 KiB
    <?php
    
    use \WPDesk\Notice\Notice;
    use \WPDesk\Notice\PermanentDismissibleNotice;
    
    /**
     * Class TestFunctions
     */
    class TestFunctions extends WP_UnitTestCase
    {
    
        /**
         * Test redeclare functions.
         */
        public function testRedeclareFunctions()
        {
            include __DIR__ . '/../../src/WPDesk/notice-functions.php';
            $this->assertTrue(true);
        }
    
        /**
         * Test WPDeskWpNotice function.
         */
        public function testWPDeskWpNotice()
        {
            $notice = wpdesk_wp_notice('test function');
    
            $this->assertInstanceOf(Notice::class, $notice);
    
            $this->expectOutputString('<div class="notice notice-info"><p>test function</p></div>');
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskWpNoticeInfo function.
         */
        public function testWPDeskWpNoticeInfo()
        {
            $notice = wpdesk_wp_notice_info('test function');
    
            $this->assertInstanceOf(Notice::class, $notice);
    
            $this->expectOutputString('<div class="notice notice-info"><p>test function</p></div>');
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskWpNoticeError function.
         */
        public function testWPDeskWpNoticeError()
        {
            $notice = wpdesk_wp_notice_error('test function');
    
            $this->assertInstanceOf(Notice::class, $notice);
    
            $this->expectOutputString('<div class="notice notice-error"><p>test function</p></div>');
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskWpNoticeWarning function.
         */
        public function testWPDeskWpNoticeWarning()
        {
            $notice = wpdesk_wp_notice_warning('test function');
    
            $this->assertInstanceOf(Notice::class, $notice);
    
            $this->expectOutputString('<div class="notice notice-warning"><p>test function</p></div>');
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskWpNoticeSuccess function.
         */
        public function testWPDeskWpNoticeSuccess()
        {
            $notice = wpdesk_wp_notice_success('test function');
    
            $this->assertInstanceOf(Notice::class, $notice);
    
            $this->expectOutputString('<div class="notice notice-success"><p>test function</p></div>');
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskPermanentDismissibleWpNotice function.
         */
        public function testWPDeskPermanentDismissibleWpNotice()
        {
            $notice = wpdesk_permanent_dismissible_wp_notice(
                'test function',
                'test-notice',
                Notice::NOTICE_TYPE_INFO
            );
    
            $this->assertInstanceOf(PermanentDismissibleNotice::class, $notice);
    
            $this->expectOutputString(
                '<div class="notice notice-info is-dismissible" data-notice-name="test-notice" id="wpdesk-notice-test-notice"><p>test function</p></div>'
            );
    
            $notice->showNotice();
        }
    
        /**
         * Test WPDeskInitNoticeAjaxHandler function.
         */
        public function testWPDeskInitWpNoticeAjaxHandler()
        {
            $ajax_handler = wpdesk_init_wp_notice_ajax_handler();
    
            $this->assertInstanceOf(\WPDesk\Notice\AjaxHandler::class, $ajax_handler);
        }
    
    }