Changeset 47122 for trunk/tests/phpunit/tests/rest-api.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api.php
r46586 r47122 317 317 318 318 /** 319 * The 'methods' arg should a comma seperated string.320 */ 321 public function test_route_method_comma_sep erated() {319 * The 'methods' arg should a comma-separated string. 320 */ 321 public function test_route_method_comma_separated() { 322 322 register_rest_route( 323 323 'test-ns', … … 709 709 $this->assertTrue( is_admin() ); 710 710 711 // Test an HTTP URL 711 // Test an HTTP URL. 712 712 unset( $_SERVER['HTTPS'] ); 713 713 $url = get_rest_url(); 714 714 $this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) ); 715 715 716 // Test an HTTPS URL 716 // Test an HTTPS URL. 717 717 $_SERVER['HTTPS'] = 'on'; 718 718 $url = get_rest_url(); 719 719 $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) ); 720 720 721 // Switch to an admin request on a different domain name 721 // Switch to an admin request on a different domain name. 722 722 $_SERVER['SERVER_NAME'] = 'admin.example.org'; 723 723 update_option( 'siteurl', 'http://admin.example.org' ); 724 724 $this->assertNotEquals( $_SERVER['SERVER_NAME'], parse_url( home_url(), PHP_URL_HOST ) ); 725 725 726 // // Test an HTTP URL726 // Test an HTTP URL. 727 727 unset( $_SERVER['HTTPS'] ); 728 728 $url = get_rest_url(); 729 729 $this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) ); 730 730 731 // // Test an HTTPS URL731 // Test an HTTPS URL. 732 732 $_SERVER['HTTPS'] = 'on'; 733 733 $url = get_rest_url(); 734 734 $this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) ); 735 735 736 // Reset 736 // Reset. 737 737 update_option( 'siteurl', $_siteurl ); 738 738 set_current_screen( 'front' ); … … 769 769 public function jsonp_callback_provider() { 770 770 return array( 771 // Standard names 771 // Standard names. 772 772 array( 'Springfield', true ), 773 773 array( 'shelby.ville', true ), … … 775 775 array( 'KampKrusty1', true ), 776 776 777 // Invalid names 777 // Invalid names. 778 778 array( 'ogden-ville', false ), 779 779 array( 'north haverbrook', false ), … … 794 794 public function rest_date_provider() { 795 795 return array( 796 // Valid dates with timezones 796 // Valid dates with timezones. 797 797 array( '2017-01-16T11:30:00-05:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) + 5 * HOUR_IN_SECONDS ), 798 798 array( '2017-01-16T11:30:00-05:30', gmmktime( 11, 30, 0, 1, 16, 2017 ) + 5.5 * HOUR_IN_SECONDS ), … … 803 803 array( '2017-01-16T11:30:00Z', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), 804 804 805 // Valid dates without timezones 805 // Valid dates without timezones. 806 806 array( '2017-01-16T11:30:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), 807 807 808 // Invalid dates (TODO: support parsing partial dates as ranges, see #38641) 808 // Invalid dates (TODO: support parsing partial dates as ranges, see #38641). 809 809 array( '2017-01-16T11:30:00-5', false ), 810 810 array( '2017-01-16T11:30', false ), … … 826 826 public function rest_date_force_utc_provider() { 827 827 return array( 828 // Valid dates with timezones 828 // Valid dates with timezones. 829 829 array( '2017-01-16T11:30:00-05:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), 830 830 array( '2017-01-16T11:30:00-05:30', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), … … 835 835 array( '2017-01-16T11:30:00Z', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), 836 836 837 // Valid dates without timezones 837 // Valid dates without timezones. 838 838 array( '2017-01-16T11:30:00', gmmktime( 11, 30, 0, 1, 16, 2017 ) ), 839 839 840 // Invalid dates (TODO: support parsing partial dates as ranges, see #38641) 840 // Invalid dates (TODO: support parsing partial dates as ranges, see #38641). 841 841 array( '2017-01-16T11:30:00-5', false ), 842 842 array( '2017-01-16T11:30', false ),
Note: See TracChangeset
for help on using the changeset viewer.