Make WordPress Core

Ticket #39264: 39264.13.diff

File 39264.13.diff, 1.1 KB (added by jnylen0, 8 years ago)

¡Una más!

  • tests/phpunit/tests/rest-api/rest-schema-setup.php

    diff --git a/tests/phpunit/tests/rest-api/rest-schema-setup.php b/tests/phpunit/tests/rest-api/rest-schema-setup.php
    index c286504..eea2224 100644
    a b class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { 
    3737                $this->assertTrue( is_array( $routes ), '`get_routes` should return an array.' );
    3838                $this->assertTrue( ! empty( $routes ), 'Routes should not be empty.' );
    3939
     40                $routes = array_filter( array_keys( $routes ), array( $this, 'is_builtin_route' ) );
     41
    4042                $expected_routes = array(
    4143                        '/',
    4244                        '/oembed/1.0',
    class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { 
    7072                        '/wp/v2/settings',
    7173                );
    7274
    73                 $this->assertEquals( $expected_routes, array_keys( $routes ) );
     75                $this->assertEquals( $expected_routes, $routes );
     76        }
     77
     78        private function is_builtin_route( $route ) {
     79                return (
     80                        '/' === $route ||
     81                        preg_match( '#^/oembed/1\.0(/.+)?$#', $route ) ||
     82                        preg_match( '#^/wp/v2(/.+)?$#', $route )
     83                );
    7484        }
    7585
    7686        public function test_build_wp_api_client_fixtures() {