WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/23/2017 09:57:31 PM (2 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Introduce skipWithoutMultisite() and skipWithMultisite() methods into the test suite.

This brings much needed uniformity to test skipping when a test requires Multisite or when a test should be excluded from running when Multisite is enabled.

Used in conjunction with the @group ms-required and @group ms-excluded notation, this removes a significant number of skipped tests from the default test suite run.

Fixes #40531

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/query.php

    r40530 r40543  
    556556     */
    557557    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_blog_id_on_nonms() {
    558         if ( is_multisite() ) {
    559             $this->markTestSkipped( __METHOD__ . ' is a non-multisite-only test.' );
    560         }
     558        $this->skipWithMultisite();
    561559
    562560        $query = new WP_User_Query( array(
     
    577575     */
    578576    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_current_blog_id_on_ms() {
    579         if ( ! is_multisite() ) {
    580             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    581         }
     577        $this->skipWithoutMultisite();
    582578
    583579        $query = new WP_User_Query( array(
     
    598594     */
    599595    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all_with_meta() {
    600         if ( ! is_multisite() ) {
    601             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    602         }
     596        $this->skipWithoutMultisite();
    603597
    604598        $b = self::factory()->blog->create();
     
    625619     */
    626620    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all() {
    627         if ( ! is_multisite() ) {
    628             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    629         }
     621        $this->skipWithoutMultisite();
    630622
    631623        $b = self::factory()->blog->create();
     
    651643     */
    652644    public function test_who_authors() {
    653         if ( ! is_multisite() ) {
    654             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    655         }
     645        $this->skipWithoutMultisite();
    656646
    657647        $b = self::factory()->blog->create();
     
    678668     */
    679669    public function test_who_authors_should_work_alongside_meta_query() {
    680         if ( ! is_multisite() ) {
    681             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    682         }
     670        $this->skipWithoutMultisite();
    683671
    684672        $b = self::factory()->blog->create();
     
    714702     */
    715703    public function test_who_authors_should_work_alongside_meta_params() {
    716         if ( ! is_multisite() ) {
    717             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    718         }
     704        $this->skipWithoutMultisite();
    719705
    720706        $b = self::factory()->blog->create();
     
    808794     */
    809795    public function test_has_published_posts_should_respect_blog_id() {
    810         if ( ! is_multisite() ) {
    811             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    812         }
     796        $this->skipWithoutMultisite();
    813797
    814798        $blogs = self::factory()->blog->create_many( 2 );
     
    13761360     */
    13771361    public function test_blog_id_should_restrict_by_blog_without_requiring_a_named_role() {
    1378         if ( ! is_multisite() ) {
    1379             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    1380         }
     1362        $this->skipWithoutMultisite();
    13811363
    13821364        $sites = self::factory()->blog->create_many( 2 );
     
    13991381     */
    14001382    public function test_calling_prepare_query_a_second_time_should_not_add_another_cap_query_on_multisite() {
    1401         if ( ! is_multisite() ) {
    1402             $this->markTestSkipped( __METHOD__ . ' requires Multisite.' );
    1403         }
     1383        $this->skipWithoutMultisite();
    14041384
    14051385        $site_id = get_current_blog_id();
Note: See TracChangeset for help on using the changeset viewer.