WordPress.org

Make WordPress Core

Ticket #39933: 0002-use-WP-spacing-instead-of-PSR-spacing.patch

File 0002-use-WP-spacing-instead-of-PSR-spacing.patch, 3.4 KB (added by mnelson4, 4 years ago)

fixes spacing issue from previous commit

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

    From 1943b44cf31eefce32881422fe48742c593cba3c Mon Sep 17 00:00:00 2001
    From: Mike Nelson <michael@eventespresso.com>
    Date: Wed, 22 Feb 2017 20:41:47 -0800
    Subject: [PATCH 2/2] use WP spacing instead of PSR spacing
    
    ---
     tests/phpunit/tests/rest-api/rest-request.php | 88 +++++++++++++--------------
     1 file changed, 44 insertions(+), 44 deletions(-)
    
    diff --git a/tests/phpunit/tests/rest-api/rest-request.php b/tests/phpunit/tests/rest-api/rest-request.php
    index a6b9885..f4364e3 100644
    a b class Tests_REST_Request extends WP_UnitTestCase { 
    208208         * WP_REST_Request does it for us.
    209209         */
    210210        public function test_parameters_for_put() {
    211                 $this->_test_parameters_request_method('PUT');
    212         }
    213 
    214     /**
    215     * PATCH requests don't get $_POST automatically parsed, so ensure that
    216     * WP_REST_Request does it for us.
    217     */
    218     public function test_parameters_for_patch() {
    219         $this->_test_parameters_request_method('PATCH');
    220     }
    221 
    222     /**
    223     * DELETE requests don't get $_POST automatically parsed, so ensure that
    224     * WP_REST_Request does it for us.
    225     */
    226     public function test_parameters_for_delete() {
    227         $this->_test_parameters_request_method('DELETE');
    228     }
    229 
    230     /**
    231     * Test logic shared between various test methods
    232      * @param string $request_method
    233      */
    234         protected function _test_parameters_request_method( $request_method = 'POST' ){
    235         $data = array(
    236             'foo' => 'bar',
    237             'alot' => array(
    238                 'of' => 'parameters',
    239             ),
    240             'list' => array(
    241                 'of',
    242                 'cool',
    243                 'stuff',
    244             ),
    245         );
    246 
    247         $this->request->set_method( $request_method );
    248         $this->request->set_body_params( array() );
    249         $this->request->set_body( http_build_query( $data ) );
    250 
    251         foreach ( $data as $key => $expected_value ) {
    252             $this->assertEquals( $expected_value, $this->request->get_param( $key ), 'Using request method ' . $request_method );
    253         }
    254     }
     211                $this->_test_parameters_request_method( 'PUT' );
     212        }
     213
     214        /**
     215        * PATCH requests don't get $_POST automatically parsed, so ensure that
     216        * WP_REST_Request does it for us.
     217        */
     218        public function test_parameters_for_patch() {
     219                $this->_test_parameters_request_method( 'PATCH' );
     220        }
     221
     222        /**
     223        * DELETE requests don't get $_POST automatically parsed, so ensure that
     224        * WP_REST_Request does it for us.
     225        */
     226        public function test_parameters_for_delete() {
     227                $this->_test_parameters_request_method( 'DELETE' );
     228        }
     229
     230        /**
     231        * Test logic shared between various test methods
     232         *
     233         * @param string $request_method
     234         */
     235        protected function _test_parameters_request_method( $request_method = 'POST' ) {
     236                $data = array(
     237                        'foo'  => 'bar',
     238                        'alot' => array(
     239                                'of' => 'parameters',
     240                        ),
     241                        'list' => array(
     242                                'of',
     243                                'cool',
     244                                'stuff',
     245                        ),
     246                );
     247                $this->request->set_method( $request_method );
     248                $this->request->set_body_params( array() );
     249                $this->request->set_body( http_build_query( $data ) );
     250                foreach ( $data as $key => $expected_value ) {
     251                        $this->assertEquals( $expected_value, $this->request->get_param( $key ),
     252                                'Using request method ' . $request_method );
     253                }
     254        }
    255255
    256256        public function test_parameters_for_json_put() {
    257257                $data = array(