Changeset 47122 for trunk/tests/phpunit/tests/functions.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions.php
r46966 r47122 23 23 24 24 function test_wp_parse_args_array() { 25 // arrays25 // Arrays. 26 26 $a = array(); 27 27 $this->assertEquals( array(), wp_parse_args( $a ) ); … … 141 141 function data_wp_normalize_path() { 142 142 return array( 143 // Windows paths 143 // Windows paths. 144 144 array( 'C:\\www\\path\\', 'C:/www/path/' ), 145 145 array( 'C:\\www\\\\path\\', 'C:/www/path/' ), 146 146 array( 'c:/www/path', 'C:/www/path' ), 147 array( 'c:\\www\\path\\', 'C:/www/path/' ), // uppercase drive letter147 array( 'c:\\www\\path\\', 'C:/www/path/' ), // Uppercase drive letter. 148 148 array( 'c:\\\\www\\path\\', 'C:/www/path/' ), 149 149 array( '\\\\Domain\\DFSRoots\\share\\path\\', '//Domain/DFSRoots/share/path/' ), … … 151 151 array( '\\\\Server\\share', '//Server/share' ), 152 152 153 // Linux paths 153 // Linux paths. 154 154 array( '/www/path/', '/www/path/' ), 155 155 array( '/www/path/////', '/www/path/' ), 156 156 array( '/www/path', '/www/path' ), 157 157 158 // PHP Stream wrappers158 // PHP stream wrappers. 159 159 array( 'php://input', 'php://input' ), 160 160 array( 'http://example.com//path.ext', 'http://example.com/path.ext' ), … … 167 167 $testdir = DIR_TESTDATA . '/images/'; 168 168 169 // sanity check169 // Sanity check. 170 170 $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcdefg.png' ), 'Sanitiy check failed' ); 171 171 172 // check number is appended for file already exists172 // Check number is appended for file already exists. 173 173 $this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' ); 174 174 $this->assertEquals( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' ); 175 175 $this->assertFileNotExists( $testdir . 'test-image-1.png' ); 176 176 177 // check special chars177 // Check special chars. 178 178 $this->assertEquals( 'testtést-imagé.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' ); 179 179 180 // check special chars with potential conflicting name180 // Check special chars with potential conflicting name. 181 181 $this->assertEquals( 'tést-imagé.png', wp_unique_filename( $testdir, 'tést-imagé.png' ), 'Filename with special chars failed' ); 182 182 183 // check with single quotes in name (somehow)183 // Check with single quotes in name (somehow). 184 184 $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' ); 185 185 186 // check with single quotes in name (somehow)186 // Check with double quotes in name (somehow). 187 187 $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' ); 188 188 189 // test crazy name (useful for regression tests)189 // Test crazy name (useful for regression tests). 190 190 $this->assertEquals( '12af34567890@..^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' ); 191 191 192 // test slashes in names192 // Test slashes in names. 193 193 $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' ); 194 194 $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' ); … … 526 526 $this->assertNotEmpty( $mimes ); 527 527 528 // upload_mimes shouldn't affect wp_get_mime_types()528 // 'upload_mimes' should not affect wp_get_mime_types(). 529 529 add_filter( 'upload_mimes', '__return_empty_array' ); 530 530 $mimes = wp_get_mime_types(); … … 647 647 function data_device_can_upload() { 648 648 return array( 649 // iPhone iOS 5.0.1, Safari 5.1 649 // iPhone iOS 5.0.1, Safari 5.1. 650 650 array( 651 651 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A406)', 652 652 false, 653 653 ), 654 // iPad iOS 3.2, Safari 4.0.4 654 // iPad iOS 3.2, Safari 4.0.4. 655 655 array( 656 656 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10', 657 657 false, 658 658 ), 659 // iPod iOS 4.3.3, Safari 5.0.2 659 // iPod iOS 4.3.3, Safari 5.0.2. 660 660 array( 661 661 'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5', 662 662 false, 663 663 ), 664 // iPhone iOS 6.0.0, Safari 6.0 664 // iPhone iOS 6.0.0, Safari 6.0. 665 665 array( 666 666 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25', 667 667 true, 668 668 ), 669 // iPad iOS 6.0.0, Safari 6.0 669 // iPad iOS 6.0.0, Safari 6.0. 670 670 array( 671 671 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25', 672 672 true, 673 673 ), 674 // Android 2.2, Android Webkit Browser 674 // Android 2.2, Android Webkit Browser. 675 675 array( 676 676 'Mozilla/5.0 (Android 2.2; Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4', 677 677 true, 678 678 ), 679 // BlackBerry 9900, BlackBerry browser 679 // BlackBerry 9900, BlackBerry browser. 680 680 array( 681 681 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+', 682 682 true, 683 683 ), 684 // Windows Phone 8.0, Internet Explorer 10.0 ;684 // Windows Phone 8.0, Internet Explorer 10.0. 685 685 array( 686 686 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)', 687 687 true, 688 688 ), 689 // Ubuntu desktop, Firefox 41.0 689 // Ubuntu desktop, Firefox 41.0. 690 690 array( 691 691 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0', … … 717 717 'http://تشادر.icom.museum', 718 718 'http://中国.icom.museum', 719 #'http://القمر.icom.museum', // Comoroshttp://القمر.icom.museum720 #'http://κυπρος.icom.museum', Cyprushttp://κυπρος.icom.museum719 // 'http://القمر.icom.museum', // Comoros http://القمر.icom.museum 720 // 'http://κυπρος.icom.museum', // Cyprus http://κυπρος.icom.museum 721 721 'http://českárepublika.icom.museum', 722 #'http://مصر.icom.museum', // Egypthttp://مصر.icom.museum722 // 'http://مصر.icom.museum', // Egypt http://مصر.icom.museum 723 723 'http://ελλάδα.icom.museum', 724 724 'http://magyarország.icom.museum', … … 736 736 'http://لبنان.icom.museum', 737 737 'http://македонија.icom.museum', 738 #'http://موريتانيا.icom.museum', // Mauritaniahttp://موريتانيا.icom.museum738 // 'http://موريتانيا.icom.museum', // Mauritania http://موريتانيا.icom.museum 739 739 'http://méxico.icom.museum', 740 740 'http://монголулс.icom.museum', 741 #'http://المغرب.icom.museum', // Moroccohttp://المغرب.icom.museum741 // 'http://المغرب.icom.museum', // Morocco http://المغرب.icom.museum 742 742 'http://नेपाल.icom.museum', 743 #'http://عمان.icom.museum', // Omanhttp://عمان.icom.museum743 // 'http://عمان.icom.museum', // Oman http://عمان.icom.museum 744 744 'http://قطر.icom.museum', 745 745 'http://românia.icom.museum', … … 827 827 828 828 $exploded = array_values( array_filter( array_map( 'trim', explode( "\n", $blob ) ) ) ); 829 // wp_extract_urls calls html_entity_decode829 // wp_extract_urls() calls html_entity_decode(). 830 830 $decoded = array_map( 'html_entity_decode', $exploded ); 831 831 … … 1665 1665 array( '00', false ), 1666 1666 array( '30:-10', false ), 1667 array( ':30:00', false ), // Missing HH.1667 array( ':30:00', false ), // Missing HH. 1668 1668 array( 'MM:30:00', false ), // Invalid HH. 1669 1669 array( '30:MM:00', false ), // Invalid ii. 1670 1670 array( '30:30:MM', false ), // Invalid ss. 1671 array( '30:MM', false ), // Invalid ss.1672 array( 'MM:00', false ), // Invalid ii.1673 array( 'MM:MM', false ), // Invalid ii and ss.1674 array( '10 :30', false ), // Containing a space.1675 array( '59:61', false ), // Out of bound.1676 array( '61:59', false ), // Out of bound.1677 array( '3:59:61', false ), // Out of bound.1671 array( '30:MM', false ), // Invalid ss. 1672 array( 'MM:00', false ), // Invalid ii. 1673 array( 'MM:MM', false ), // Invalid ii and ss. 1674 array( '10 :30', false ), // Containing a space. 1675 array( '59:61', false ), // Out of bound. 1676 array( '61:59', false ), // Out of bound. 1677 array( '3:59:61', false ), // Out of bound. 1678 1678 array( '03:61:59', false ), // Out of bound. 1679 1679 );
Note: See TracChangeset
for help on using the changeset viewer.