Make WordPress Core

Ticket #31491: 31491.patch

File 31491.patch, 4.1 KB (added by ocean90, 9 years ago)
  • tests/phpunit/tests/pluggable.php

     
    1515         */
    1616        public function testPluggableFunctionSignaturesMatch( $function ) {
    1717
    18                 if ( wp_using_ext_object_cache() ) {
    19                         // #31491
    20                         $this->markTestSkipped( 'Pluggable function signatures are not tested when an external object cache is in use.' );
    21                 }
    22 
    2318                $signatures = $this->getPluggableFunctionSignatures();
    2419
    2520                $this->assertTrue( function_exists( $function ) );
     
    9186                );
    9287                $test_files = array(
    9388                        'wp-includes/pluggable.php',
    94                         'wp-includes/cache.php',
    9589                );
     90
     91                // Pluggable function signatures are not tested when an external object cache is in use. #31491
     92                if ( ! wp_using_ext_object_cache() ) {
     93                        $test_files[] = 'wp-includes/cache.php';
     94                }
     95
    9696                $data = array();
    9797
    9898                foreach ( $test_functions as $function ) {
     
    122122         */
    123123        public function getPluggableFunctionSignatures() {
    124124
    125                 return array(
     125                $signatures = array(
    126126
    127127                        // wp-includes/pluggable.php:
    128128                        'wp_set_current_user'             => array( 'id', 'name' => '' ),
     
    165165                        'get_avatar'                      => array( 'id_or_email', 'size' => 96, 'default' => '', 'alt' => '', 'args' => null ),
    166166                        'wp_text_diff'                    => array( 'left_string', 'right_string', 'args' => null ),
    167167
    168                         // wp-includes/cache.php:
    169                         'wp_cache_add'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    170                         'wp_cache_close'                     => array(),
    171                         'wp_cache_decr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
    172                         'wp_cache_delete'                    => array( 'key', 'group' => '' ),
    173                         'wp_cache_flush'                     => array(),
    174                         'wp_cache_get'                       => array( 'key', 'group' => '', 'force' => false, 'found' => null ),
    175                         'wp_cache_incr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
    176                         'wp_cache_init'                      => array(),
    177                         'wp_cache_replace'                   => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    178                         'wp_cache_set'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    179                         'wp_cache_switch_to_blog'            => array( 'blog_id' ),
    180                         'wp_cache_add_global_groups'         => array( 'groups' ),
    181                         'wp_cache_add_non_persistent_groups' => array( 'groups' ),
    182                         'wp_cache_reset'                     => array(),
    183 
    184168                        // wp-admin/includes/schema.php:
    185169                        'install_network'                    => array(),
    186170
     
    190174                        'wp_new_blog_notification'           => array( 'blog_title', 'blog_url', 'user_id', 'password' ),
    191175                        'wp_upgrade'                         => array(),
    192176                        'install_global_terms'               => array(),
    193 
    194177                );
    195178
     179                // Pluggable function signatures are not tested when an external object cache is in use. #31491
     180                if ( ! wp_using_ext_object_cache() ) {
     181                        $signatures = array_merge( $signatures, array(
     182
     183                                // wp-includes/cache.php:
     184                                'wp_cache_add'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
     185                                'wp_cache_close'                     => array(),
     186                                'wp_cache_decr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
     187                                'wp_cache_delete'                    => array( 'key', 'group' => '' ),
     188                                'wp_cache_flush'                     => array(),
     189                                'wp_cache_get'                       => array( 'key', 'group' => '', 'force' => false, 'found' => null ),
     190                                'wp_cache_incr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
     191                                'wp_cache_init'                      => array(),
     192                                'wp_cache_replace'                   => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
     193                                'wp_cache_set'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
     194                                'wp_cache_switch_to_blog'            => array( 'blog_id' ),
     195                                'wp_cache_add_global_groups'         => array( 'groups' ),
     196                                'wp_cache_add_non_persistent_groups' => array( 'groups' ),
     197                                'wp_cache_reset'                     => array(),
     198                        ) );
     199                }
     200
     201                return $signatures;
    196202        }
    197203
    198204}