Make WordPress Core

Ticket #50724: 50724.2.diff

File 50724.2.diff, 6.5 KB (added by pbiron, 4 years ago)
  • src/wp-includes/sitemaps.php

    From db4351fa95de47dd304753154a6cb1bad59db83b Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Tue, 21 Jul 2020 09:42:53 -0600
    Subject: [PATCH] no message
    
    ---
     src/wp-includes/sitemaps.php                   |  2 +-
     tests/phpunit/tests/sitemaps/functions.php     |  4 ++--
     .../tests/sitemaps/sitemaps-registry.php       | 18 +++++++++---------
     tests/phpunit/tests/sitemaps/sitemaps.php      | 18 +++++++++---------
     4 files changed, 21 insertions(+), 21 deletions(-)
    
    diff --git a/src/wp-includes/sitemaps.php b/src/wp-includes/sitemaps.php
    index f556246be5..b0a1dc4dbd 100644
    a b function wp_sitemaps_get_server() { 
    5151 *
    5252 * @return WP_Sitemaps_Provider[] Array of sitemap providers.
    5353 */
    54 function wp_get_sitemaps() {
     54function wp_get_sitemaps_providers() {
    5555        $sitemaps = wp_sitemaps_get_server();
    5656
    5757        if ( ! $sitemaps ) {
  • tests/phpunit/tests/sitemaps/functions.php

    diff --git a/tests/phpunit/tests/sitemaps/functions.php b/tests/phpunit/tests/sitemaps/functions.php
    index dd4796b438..2c4cce5a35 100644
    a b class Test_Sitemaps_Functions extends WP_UnitTestCase { 
    4343        /**
    4444         * Test wp_get_sitemaps default functionality
    4545         */
    46         public function test_wp_get_sitemaps() {
    47                 $sitemaps = wp_get_sitemaps();
     46        public function test_wp_get_sitemaps_providers() {
     47                $sitemaps = wp_get_sitemaps_providers();
    4848
    4949                $expected = array(
    5050                        'posts'      => 'WP_Sitemaps_Posts',
  • tests/phpunit/tests/sitemaps/sitemaps-registry.php

    diff --git a/tests/phpunit/tests/sitemaps/sitemaps-registry.php b/tests/phpunit/tests/sitemaps/sitemaps-registry.php
    index faeba78852..b5ac7e952c 100644
    a b class Test_WP_Sitemaps_Registry extends WP_UnitTestCase { 
    88                $provider = new WP_Sitemaps_Test_Provider();
    99                $registry = new WP_Sitemaps_Registry();
    1010
    11                 $actual   = $registry->add_provider( 'foo', $provider );
    12                 $sitemaps = $registry->get_providers();
     11                $actual    = $registry->add_provider( 'foo', $provider );
     12                $providers = $registry->get_providers();
    1313
    1414                $this->assertTrue( $actual );
    15                 $this->assertCount( 1, $sitemaps );
    16                 $this->assertSame( $sitemaps['foo'], $provider, 'Can not confirm sitemap registration is working.' );
     15                $this->assertCount( 1, $providers );
     16                $this->assertSame( $providers['foo'], $provider, 'Can not confirm sitemap registration is working.' );
    1717        }
    1818
    1919        public function test_add_provider_prevent_duplicates() {
    class Test_WP_Sitemaps_Registry extends WP_UnitTestCase { 
    2121                $provider2 = new WP_Sitemaps_Test_Provider();
    2222                $registry  = new WP_Sitemaps_Registry();
    2323
    24                 $actual1  = $registry->add_provider( 'foo', $provider1 );
    25                 $actual2  = $registry->add_provider( 'foo', $provider2 );
    26                 $sitemaps = $registry->get_providers();
     24                $actual1   = $registry->add_provider( 'foo', $provider1 );
     25                $actual2   = $registry->add_provider( 'foo', $provider2 );
     26                $providers = $registry->get_providers();
    2727
    2828                $this->assertTrue( $actual1 );
    2929                $this->assertFalse( $actual2 );
    30                 $this->assertCount( 1, $sitemaps );
    31                 $this->assertSame( $sitemaps['foo'], $provider1, 'Can not confirm sitemap registration is working.' );
     30                $this->assertCount( 1, $providers );
     31                $this->assertSame( $providers['foo'], $provider1, 'Can not confirm sitemap registration is working.' );
    3232        }
    3333}
  • tests/phpunit/tests/sitemaps/sitemaps.php

    diff --git a/tests/phpunit/tests/sitemaps/sitemaps.php b/tests/phpunit/tests/sitemaps/sitemaps.php
    index 35a5d6e8b6..d00e89d163 100644
    a b class Test_Sitemaps extends WP_UnitTestCase { 
    100100        public function _get_sitemap_entries() {
    101101                $entries = array();
    102102
    103                 $providers = wp_get_sitemaps();
     103                $providers = wp_get_sitemaps_providers();
    104104
    105105                foreach ( $providers as $provider ) {
    106106                        // Using `array_push` is more efficient than `array_merge` in the loop.
    class Test_Sitemaps extends WP_UnitTestCase { 
    218218         * Tests getting a URL list for post type post.
    219219         */
    220220        public function test_get_url_list_post() {
    221                 $providers = wp_get_sitemaps();
     221                $providers = wp_get_sitemaps_providers();
    222222
    223223                $post_list = $providers['posts']->get_url_list( 1, 'post' );
    224224
    class Test_Sitemaps extends WP_UnitTestCase { 
    234234                // Short circuit the show on front option.
    235235                add_filter( 'pre_option_show_on_front', '__return_true' );
    236236
    237                 $providers = wp_get_sitemaps();
     237                $providers = wp_get_sitemaps_providers();
    238238
    239239                $post_list = $providers['posts']->get_url_list( 1, 'page' );
    240240
    class Test_Sitemaps extends WP_UnitTestCase { 
    247247         * Tests getting a URL list for post type page with included home page.
    248248         */
    249249        public function test_get_url_list_page_with_home() {
    250                 $providers = wp_get_sitemaps();
     250                $providers = wp_get_sitemaps_providers();
    251251
    252252                $post_list = $providers['posts']->get_url_list( 1, 'page' );
    253253
    class Test_Sitemaps extends WP_UnitTestCase { 
    270270        public function test_get_url_list_private_post() {
    271271                wp_set_current_user( self::$editor_id );
    272272
    273                 $providers = wp_get_sitemaps();
     273                $providers = wp_get_sitemaps_providers();
    274274
    275275                $post_list_before = $providers['posts']->get_url_list( 1, 'post' );
    276276
    class Test_Sitemaps extends WP_UnitTestCase { 
    297297
    298298                $ids = self::factory()->post->create_many( 10, array( 'post_type' => $post_type ) );
    299299
    300                 $providers = wp_get_sitemaps();
     300                $providers = wp_get_sitemaps_providers();
    301301
    302302                $post_list = $providers['posts']->get_url_list( 1, $post_type );
    303303
    class Test_Sitemaps extends WP_UnitTestCase { 
    320320
    321321                self::factory()->post->create_many( 10, array( 'post_type' => $post_type ) );
    322322
    323                 $providers = wp_get_sitemaps();
     323                $providers = wp_get_sitemaps_providers();
    324324
    325325                $post_list = $providers['posts']->get_url_list( 1, $post_type );
    326326
    class Test_Sitemaps extends WP_UnitTestCase { 
    348348
    349349                self::factory()->post->create_many( 10, array( 'post_type' => $post_type ) );
    350350
    351                 $providers = wp_get_sitemaps();
     351                $providers = wp_get_sitemaps_providers();
    352352
    353353                $post_list = $providers['posts']->get_url_list( 1, $post_type );
    354354
    class Test_Sitemaps extends WP_UnitTestCase { 
    391391        public function test_register_sitemap_provider() {
    392392                wp_register_sitemap( 'test_sitemap', self::$test_provider );
    393393
    394                 $sitemaps = wp_get_sitemaps();
     394                $sitemaps = wp_get_sitemaps_providers();
    395395
    396396                $this->assertEquals( $sitemaps['test_sitemap'], self::$test_provider, 'Can not confirm sitemap registration is working.' );
    397397        }