Make WordPress Core

Ticket #37937: test.diff

File test.diff, 2.6 KB (added by birgire, 9 years ago)

Test

  • tests/phpunit/tests/multisite/siteQuery.php

     
    661661
    662662                $this->assertEqualSets( $expected, $found );
    663663        }
     664
     665
     666        /**
     667         * @ticket 37937
     668         */
     669
     670        public function test_wp_site_query_by_public_boolean_true() {
     671                $q = new WP_Site_Query();
     672                $found = $q->query( array(
     673                        'fields'       => 'ids',
     674                        // Exclude main site since we don't have control over it here.
     675                        'site__not_in' => array( 1 ),
     676                        'public'       => true,
     677                ) );
     678
     679                $this->assertEqualSets( array_values( self::$site_ids ), $found );
     680        }
     681
     682
     683        /**
     684         * @ticket 37937
     685         */
     686
     687        public function test_wp_site_query_by_public_boolean_string_true() {
     688                $q = new WP_Site_Query();
     689                $found = $q->query( array(
     690                        'fields'       => 'ids',
     691                        // Exclude main site since we don't have control over it here.
     692                        'site__not_in' => array( 1 ),
     693                        'public'     => 'true',
     694                ) );
     695
     696                $this->assertEqualSets( array_values( self::$site_ids ), $found );
     697        }
     698
     699
     700        /**
     701         * @ticket 37937
     702         */
     703
     704        public function test_wp_site_query_by_public_boolean_false_empty_result() {
     705                $q = new WP_Site_Query();
     706                $found = $q->query( array(
     707                        'fields'       => 'ids',
     708                        // Exclude main site since we don't have control over it here.
     709                        'site__not_in' => array( 1 ),
     710                        'public'       => false,
     711                ) );
     712               
     713                $this->assertEmpty( $found );
     714        }
     715
     716
     717        /**
     718         * @ticket 37937
     719         */
     720
     721        public function test_wp_site_query_by_public_boolean_string_false_empty_result() {
     722                $q = new WP_Site_Query();
     723                $found = $q->query( array(
     724                        'fields'       => 'ids',
     725                        // Exclude main site since we don't have control over it here.
     726                        'site__not_in' => array( 1 ),
     727                        'public'       => 'false',
     728                ) );
     729               
     730                $this->assertEmpty( $found );
     731        }
     732
    664733}
    665734
    666735endif;