Make WordPress Core

Ticket #26659: ticket-26659-ajax-tests.patch

File ticket-26659-ajax-tests.patch, 2.7 KB (added by bpetty, 10 years ago)
  • tests/phpunit/tests/ajax/DeleteComment.php

    diff --git tests/phpunit/tests/ajax/DeleteComment.php tests/phpunit/tests/ajax/DeleteComment.php
    index 97a2c02..ee7d257 100644
    class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase { 
    2626         */
    2727        public function setUp() {
    2828                parent::setUp();
     29
     30                // Turn off comment notifications for tests.
     31                update_option( 'comments_notify', 0 );
     32
    2933                $post_id = $this->factory->post->create();
    3034                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
    3135                $this->_comments = array_map( 'get_comment', $this->_comments );
    3236        }
    3337
    3438        /**
     39         * Reset default settings.
     40         */
     41        public function tearDown() {
     42                // Turn comment notifications back on.
     43                update_option( 'comments_notify', 1 );
     44        }
     45
     46        /**
    3547         * Clear the POST actions in between requests
    3648         */
    3749        protected function _clear_post_action() {
  • tests/phpunit/tests/ajax/DimComment.php

    diff --git tests/phpunit/tests/ajax/DimComment.php tests/phpunit/tests/ajax/DimComment.php
    index d34b64d..1bfe33c 100644
    class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase { 
    2626         */
    2727        public function setUp() {
    2828                parent::setUp();
     29
     30                // Turn off comment notifications for tests.
     31                update_option( 'comments_notify', 0 );
     32
    2933                $post_id = $this->factory->post->create();
    3034                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
    3135                $this->_comments = array_map( 'get_comment', $this->_comments );
    3236        }
    3337
    3438        /**
     39         * Reset default settings.
     40         */
     41        public function tearDown() {
     42                // Turn comment notifications back on.
     43                update_option( 'comments_notify', 1 );
     44        }
     45
     46        /**
    3547         * Clear the POST actions in between requests
    3648         */
    3749        protected function _clear_post_action() {
  • tests/phpunit/tests/ajax/ReplytoComment.php

    diff --git tests/phpunit/tests/ajax/ReplytoComment.php tests/phpunit/tests/ajax/ReplytoComment.php
    index 7935bc2..4cea72c 100644
    class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase { 
    3232         */
    3333        public function setUp() {
    3434                parent::setUp();
     35
     36                // Turn off comment notifications for tests.
     37                update_option( 'comments_notify', 0 );
     38
    3539                $post_id = $this->factory->post->create();
    3640                $this->factory->comment->create_post_comments( $post_id, 5 );
    3741                $this->_comment_post = get_post( $post_id );
    class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase { 
    4347        }
    4448
    4549        /**
     50         * Reset default settings.
     51         */
     52        public function tearDown() {
     53                // Turn comment notifications back on.
     54                update_option( 'comments_notify', 1 );
     55        }
     56
     57        /**
    4658         * Reply as a privilged user (administrator)
    4759         * Expects test to pass
    4860         * @return void