Make WordPress Core

Ticket #51986: 51986.test.diff

File 51986.test.diff, 736 bytes (added by nateallen, 3 years ago)

Unit test confirming fix for bug

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

    diff --git a/tests/phpunit/tests/rest-api.php b/tests/phpunit/tests/rest-api.php
    index fa25502959..bdcedeb1a1 100644
    a b class Tests_REST_API extends WP_UnitTestCase { 
    25182518                        array( 'description', '_links' )
    25192519                );
    25202520        }
     2521
     2522        /**
     2523         * @ticket 51986
     2524         */
     2525        public function test_route_args_array() {
     2526                $this->setExpectedIncorrectUsage( 'register_rest_route' );
     2527
     2528                $registered = register_rest_route(
     2529                        'my-ns/v1',
     2530                        '/my-route',
     2531                        array(
     2532                                'callback'            => '__return_true',
     2533                                'permission_callback' => '__return_true',
     2534                                'args'                => array( 'string' ),
     2535                        )
     2536                );
     2537
     2538                $this->assertTrue( $registered );
     2539        }
    25212540}