Skip to:
Content

BuddyPress.org

Changeset 12246


Ignore:
Timestamp:
10/05/2018 05:24:17 PM (8 years ago)
Author:
boonebgorges
Message:

Tests: Move wpmu_new_blog and delete_blog expectedDeprecated calls into test logic.

Use of the @expectedDeprecated annotation means that the deprecation notice is
expected across all versions of WordPress, while we in fact need to suppress the
notices only on WP 5.0+.

See #7984.

Location:
trunk/tests/phpunit/testcases
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/functions.php

    r12245 r12246  
    805805         * @group bp_activity_format_activity_action_custom_post_type_post_ms
    806806         * @group activity_tracking
    807          * @expectedDeprecated wpmu_new_blog
    808807         */
    809808        public function test_bp_activity_format_activity_action_custom_post_type_post_ms() {
    810809                if ( ! is_multisite() ) {
    811810                        $this->markTestSkipped();
     811                }
     812
     813                if ( function_exists( 'wp_initialize_site' ) ) {
     814                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    812815                }
    813816
    … …  
    918921         * @group bp_activity_format_activity_action_custom_post_type_post_ms
    919922         * @group activity_tracking
    920          * @expectedDeprecated wpmu_new_blog
    921923         */
    922924        public function test_bp_activity_format_activity_action_custom_string_post_type_post_ms() {
    923925                if ( ! is_multisite() ) {
    924926                        $this->markTestSkipped();
     927                }
     928
     929                if ( function_exists( 'wp_initialize_site' ) ) {
     930                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    925931                }
    926932
    … …  
    10561062        public function test_bp_activity_format_activity_action_custom_post_type_comment() {
    10571063                if ( is_multisite() ) {
    1058                         $this->setExpectedDeprecated( 'wpmu_new_blog' );
     1064                        if ( function_exists( 'wp_initialize_site' ) ) {
     1065                                $this->setExpectedDeprecated( 'wpmu_new_blog' );
     1066                        }
     1067
    10591068                        $b = self::factory()->blog->create();
    10601069                        switch_to_blog( $b );
  • trunk/tests/phpunit/testcases/blogs/activity.php

    r12244 r12246  
    2424         * @group activity_action
    2525         * @group bp_blogs_format_activity_action_new_blog
    26          * @expectedDeprecated wpmu_new_blog
    2726         */
    2827        public function test_bp_blogs_format_activity_action_new_blog() {
    2928                if ( ! is_multisite() ) {
    3029                        $this->markTestSkipped();
     30                }
     31
     32                if ( function_exists( 'wp_initialize_site' ) ) {
     33                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    3134                }
    3235
    … …  
    118121         * @group activity_action
    119122         * @group bp_blogs_format_activity_action_new_blog_post
    120          * @expectedDeprecated wpmu_new_blog
    121123         */
    122124        public function test_bp_blogs_format_activity_action_new_blog_post_ms_nonrootblog() {
    123125                if ( ! is_multisite() ) {
    124126                        $this->markTestSkipped();
     127                }
     128
     129                if ( function_exists( 'wp_initialize_site' ) ) {
     130                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    125131                }
    126132
    … …  
    160166         * @group bp_blogs_format_activity_action_new_blog_comment
    161167         * @group post_type_comment_activities
    162          * @expectedDeprecated wpmu_new_blog
    163168         */
    164169        public function test_bp_blogs_format_activity_action_new_blog_comment_ms_nonrootblog() {
    165170                if ( ! is_multisite() ) {
    166171                        $this->markTestSkipped();
     172                }
     173
     174                if ( function_exists( 'wp_initialize_site' ) ) {
     175                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    167176                }
    168177
    … …  
    204213        /**
    205214         * @group bp_blogs_format_activity_action_new_blog
    206          * @expectedDeprecated wpmu_new_blog
    207215         */
    208216        public function test_bp_activity_format_activity_action_new_blog_backpat() {
    209217                if ( ! is_multisite() ) {
    210218                        $this->markTestSkipped();
     219                }
     220
     221                if ( function_exists( 'wp_initialize_site' ) ) {
     222                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    211223                }
    212224
    … …  
    233245        /**
    234246         * @group bp_blogs_format_activity_action_new_blog_post
    235          * @expectedDeprecated wpmu_new_blog
    236247         */
    237248        public function test_bp_activity_format_activity_action_new_blog_post_backpat() {
    238249                if ( ! is_multisite() ) {
    239250                        $this->markTestSkipped();
     251                }
     252
     253                if ( function_exists( 'wp_initialize_site' ) ) {
     254                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    240255                }
    241256
    … …  
    262277        /**
    263278         * @group bp_blogs_format_activity_action_new_blog_comment
    264          * @expectedDeprecated wpmu_new_blog
    265279         */
    266280        public function test_bp_activity_format_activity_action_new_blog_comment_backpat() {
    267281                if ( ! is_multisite() ) {
    268282                        $this->markTestSkipped();
     283                }
     284
     285                if ( function_exists( 'wp_initialize_site' ) ) {
     286                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    269287                }
    270288
  • trunk/tests/phpunit/testcases/blogs/cache.php

    r12244 r12246  
    88        /**
    99         * @group bp_blogs_update_meta_cache
    10          * @expectedDeprecated wpmu_new_blog
    1110         */
    1211        public function test_bp_blogs_update_meta_cache() {
    1312                if ( ! is_multisite() ) {
    1413                        $this->markTestSkipped();
     14                }
     15
     16                if ( function_exists( 'wp_initialize_site' ) ) {
     17                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    1518                }
    1619
    … …  
    9093         * @group bp_blogs_update_meta_cache
    9194         * @group bp_has_blogs
    92          * @expectedDeprecated wpmu_new_blog
    9395         */
    9496        public function test_bp_blogs_update_meta_cache_bp_has_blogs() {
    9597                if ( ! is_multisite() ) {
    9698                        $this->markTestSkipped();
     99                }
     100
     101                if ( function_exists( 'wp_initialize_site' ) ) {
     102                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    97103                }
    98104
    … …  
    185191         * @group bp_blogs_update_meta_cache
    186192         * @group bp_has_blogs
    187          * @expectedDeprecated wpmu_new_blog
    188193         */
    189194        public function test_bp_blogs_update_meta_cache_bp_has_blogs_false() {
    190195                if ( ! is_multisite() ) {
    191196                        $this->markTestSkipped();
     197                }
     198
     199                if ( function_exists( 'wp_initialize_site' ) ) {
     200                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    192201                }
    193202
    … …  
    261270        /**
    262271         * @group bp_blogs_total_blogs
    263          * @expectedDeprecated wpmu_new_blog
    264272         * @expectedDeprecated delete_blog
    265273         */
    … …  
    267275                if ( ! is_multisite() ) {
    268276                        $this->markTestSkipped();
     277                }
     278
     279                if ( function_exists( 'wp_initialize_site' ) ) {
     280                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
     281                        $this->setExpectedDeprecated( 'delete_blog' );
    269282                }
    270283
    … …  
    297310        /**
    298311         * @group update_blog_details
    299          * @expectedDeprecated wpmu_new_blog
    300312         */
    301313        public function test_update_blog_details_should_purge_blogmeta_cache() {
    302314                if ( ! is_multisite() ) {
    303315                        $this->markTestSkipped();
     316                }
     317
     318                if ( function_exists( 'wp_initialize_site' ) ) {
     319                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    304320                }
    305321
  • trunk/tests/phpunit/testcases/blogs/class-bp-blogs-blog.php

    r12244 r12246  
    66 */
    77class BP_Tests_BP_Blogs_Blog_TestCases extends BP_UnitTestCase {
    8         /**
    9          * @expectedDeprecated wpmu_new_blog
    10          */
    118        public function test_get_with_search_terms() {
    129                if ( ! is_multisite() ) {
    1310                        $this->markTestSkipped();
     11                }
     12
     13                if ( function_exists( 'wp_initialize_site' ) ) {
     14                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    1415                }
    1516
    … …  
    3536        /**
    3637         * @ticket BP5858
    37          * @expectedDeprecated wpmu_new_blog
    3838         */
    3939        public function test_get_with_search_terms_should_match_description() {
    4040                if ( ! is_multisite() ) {
    4141                        $this->markTestSkipped();
     42                }
     43
     44                if ( function_exists( 'wp_initialize_site' ) ) {
     45                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    4246                }
    4347
    … …  
    6468        }
    6569
    66         /**
    67          * @expectedDeprecated wpmu_new_blog
    68          */
    6970        public function test_search_blogs() {
    7071                if ( ! is_multisite() ) {
    7172                        $this->markTestSkipped();
     73                }
     74
     75                if ( function_exists( 'wp_initialize_site' ) ) {
     76                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    7277                }
    7378
    … …  
    9499        /**
    95100         * @group get_by_letter
    96          * @expectedDeprecated wpmu_new_blog
    97101         */
    98102        public function test_get_by_letter() {
    … …  
    100104                        $this->markTestSkipped();
    101105                        return;
     106                }
     107
     108                if ( function_exists( 'wp_initialize_site' ) ) {
     109                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    102110                }
    103111
    … …  
    124132        /**
    125133         * @group get_order_by
    126          * @expectedDeprecated wpmu_new_blog
    127134         */
    128135        public function test_get_order_by() {
    129136                if ( ! is_multisite() ) {
    130137                        $this->markTestSkipped();
     138                }
     139
     140                if ( function_exists( 'wp_initialize_site' ) ) {
     141                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    131142                }
    132143
  • trunk/tests/phpunit/testcases/blogs/functions.php

    r12245 r12246  
    282282        /**
    283283         * @group bp_blogs_restore_data
    284          * @expectedDeprecated wpmu_new_blog
    285284         */
    286285        public function test_bp_blogs_restore_data() {
    287286                if ( ! is_multisite() ) {
    288287                        $this->markTestSkipped();
     288                }
     289
     290                if ( function_exists( 'wp_initialize_site' ) ) {
     291                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    289292                }
    290293
    … …  
    888891        public function test_bp_blogs_comment_sync_activity_comment_for_custom_post_type() {
    889892                if ( is_multisite() ) {
    890                         $this->setExpectedDeprecated( 'wpmu_new_blog' );
     893                        if ( function_exists( 'wp_initialize_site' ) ) {
     894                                $this->setExpectedDeprecated( 'wpmu_new_blog' );
     895                        }
     896
    891897                        $b = self::factory()->blog->create();
    892898                        switch_to_blog( $b );
    … …  
    989995        /**
    990996         * @group bp_blogs_record_existing_blogs
    991          * @expectedDeprecated wpmu_new_blog
    992997         */
    993998        public function test_bp_blogs_record_existing_blogs_limit() {
    … …  
    9961001                }
    9971002
     1003                if ( function_exists( 'wp_initialize_site' ) ) {
     1004                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
     1005                }
     1006
    9981007                $old_user = get_current_user_id();
    9991008
    … …  
    10221031        /**
    10231032         * @group bp_blogs_remove_blog
    1024          * @expectedDeprecated wpmu_new_blog
    1025          * @expectedDeprecated delete_blog
    10261033         */
    10271034        public function test_bp_blogs_remove_blog() {
    10281035                if ( ! is_multisite() ) {
    10291036                        $this->markTestSkipped();
     1037                }
     1038
     1039                if ( function_exists( 'wp_initialize_site' ) ) {
     1040                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
     1041                        $this->setExpectedDeprecated( 'delete_blog' );
    10301042                }
    10311043
    … …  
    10711083        /**
    10721084         * @group bp_blogs_remove_blog_for_user
    1073          * @expectedDeprecated wpmu_new_blog
    10741085         */
    10751086        public function test_bp_blogs_remove_blog_for_user_is_contributor() {
    10761087                if ( ! is_multisite() ) {
    10771088                        $this->markTestSkipped();
     1089                }
     1090
     1091                if ( function_exists( 'wp_initialize_site' ) ) {
     1092                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    10781093                }
    10791094
  • trunk/tests/phpunit/testcases/core/avatars.php

    r12244 r12246  
    1919        /**
    2020         * @ticket BP4948
    21          * @expectedDeprecated wpmu_new_blog
    2221         */
    2322        function test_avatars_on_non_root_blog() {
    … …  
    2524                if ( ! is_multisite() ) {
    2625                        $this->markTestSkipped();
     26                }
     27
     28                if ( function_exists( 'wp_initialize_site' ) ) {
     29                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    2730                }
    2831
  • trunk/tests/phpunit/testcases/core/caps.php

    r12243 r12246  
    66 */
    77class BP_Tests_Core_Caps extends BP_UnitTestCase {
    8         /**
    9          * @expectedDeprecated wpmu_new_blog
    10          */
    118        public function test_bp_current_user_can_should_interpret_integer_second_param_as_a_blog_id() {
    129                if ( ! is_multisite() ) {
    1310                        $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
     11                }
     12
     13                if ( function_exists( 'wp_initialize_site' ) ) {
     14                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    1415                }
    1516
    … …  
    3031        /**
    3132         * @ticket BP6501
    32          * @expectedDeprecated wpmu_new_blog
    3333         */
    3434        public function test_bp_current_user_can_should_respect_blog_id_passed_in_args_array() {
    3535                if ( ! is_multisite() ) {
    3636                        $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
     37                }
     38
     39                if ( function_exists( 'wp_initialize_site' ) ) {
     40                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    3741                }
    3842
  • trunk/tests/phpunit/testcases/core/functions/bpCoreGetDirectoryPageIds.php

    r12244 r12246  
    255255        }
    256256
    257         /**
    258          * @expectedDeprecated wpmu_new_blog
    259          */
    260257        public function test_bp_core_get_directory_pages_multisite_delete_post_with_same_bp_page_id() {
    261258                if ( ! is_multisite() ) {
    262259                        $this->markTestSkipped();
     260                }
     261
     262                if ( function_exists( 'wp_initialize_site' ) ) {
     263                        $this->setExpectedDeprecated( 'wpmu_new_blog' );
    263264                }
    264265
  • trunk/tests/phpunit/testcases/members/functions.php

    r12245 r12246  
    516516
    517517                if ( is_multisite() ) {
    518                         $this->setExpectedDeprecated( 'wpmu_new_blog' );
     518                        if ( function_exists( 'wp_initialize_site' ) ) {
     519                                $this->setExpectedDeprecated( 'wpmu_new_blog' );
     520                        }
    519521
    520522                        $signups['ms-blog'] = array( 'signup_id' => self::factory()->signup->create( array(
  • trunk/tests/phpunit/testcases/routing/url.php

    r12245 r12246  
    4242                // (3) Multisite, root blog other than 1
    4343                if ( is_multisite() ) {
    44                         $this->setExpectedDeprecated( 'wpmu_new_blog' );
     44                        if ( function_exists( 'wp_initialize_site' ) ) {
     45                                $this->setExpectedDeprecated( 'wpmu_new_blog' );
     46                        }
    4547
    4648                        $original_root_blog = bp_get_root_blog_id();
Note: See TracChangeset for help on using the changeset viewer.