Changeset 42343 for trunk/tests/phpunit/tests/rest-api/rest-controller.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-controller.php
r39161 r42343 14 14 public function setUp() { 15 15 parent::setUp(); 16 $this->request = new WP_REST_Request( 'GET', '/wp/v2/testroute', array( 17 'args' => array( 18 'someinteger' => array( 19 'type' => 'integer', 16 $this->request = new WP_REST_Request( 17 'GET', '/wp/v2/testroute', array( 18 'args' => array( 19 'someinteger' => array( 20 'type' => 'integer', 21 ), 22 'someboolean' => array( 23 'type' => 'boolean', 24 ), 25 'somestring' => array( 26 'type' => 'string', 27 ), 28 'someenum' => array( 29 'type' => 'string', 30 'enum' => array( 'a' ), 31 ), 32 'somedate' => array( 33 'type' => 'string', 34 'format' => 'date-time', 35 ), 36 'someemail' => array( 37 'type' => 'string', 38 'format' => 'email', 39 ), 20 40 ), 21 'someboolean' => array( 22 'type' => 'boolean', 23 ), 24 'somestring' => array( 25 'type' => 'string', 26 ), 27 'someenum' => array( 28 'type' => 'string', 29 'enum' => array( 'a' ), 30 ), 31 'somedate' => array( 32 'type' => 'string', 33 'format' => 'date-time', 34 ), 35 'someemail' => array( 36 'type' => 'string', 37 'format' => 'email', 38 ), 39 ), 40 )); 41 ) 42 ); 41 43 } 42 44 … … 88 90 89 91 // Check sanitize testing. 90 $this->assertEquals( false, 92 $this->assertEquals( 93 false, 91 94 rest_sanitize_request_arg( 'false', $this->request, 'someboolean' ) 92 95 ); 93 $this->assertEquals( false, 96 $this->assertEquals( 97 false, 94 98 rest_sanitize_request_arg( '0', $this->request, 'someboolean' ) 95 99 ); 96 $this->assertEquals( false, 100 $this->assertEquals( 101 false, 97 102 rest_sanitize_request_arg( 0, $this->request, 'someboolean' ) 98 103 ); 99 $this->assertEquals( false, 104 $this->assertEquals( 105 false, 100 106 rest_sanitize_request_arg( 'FALSE', $this->request, 'someboolean' ) 101 107 ); 102 $this->assertEquals( true, 108 $this->assertEquals( 109 true, 103 110 rest_sanitize_request_arg( 'true', $this->request, 'someboolean' ) 104 111 ); 105 $this->assertEquals( true, 112 $this->assertEquals( 113 true, 106 114 rest_sanitize_request_arg( '1', $this->request, 'someboolean' ) 107 115 ); 108 $this->assertEquals( true, 116 $this->assertEquals( 117 true, 109 118 rest_sanitize_request_arg( 1, $this->request, 'someboolean' ) 110 119 ); 111 $this->assertEquals( true, 120 $this->assertEquals( 121 true, 112 122 rest_sanitize_request_arg( 'TRUE', $this->request, 'someboolean' ) 113 123 );
Note: See TracChangeset
for help on using the changeset viewer.