Changeset 35464 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 10/30/2015 11:26:44 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r35412 r35464 740 740 $year_month = date('Y/m'); 741 741 $image_meta = wp_get_attachment_metadata( self::$large_id ); 742 743 $expected = array( 744 array( 745 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month . '/' . $image_meta['sizes']['medium']['file'], 746 'descriptor' => 'w', 747 'value' => $image_meta['sizes']['medium']['width'], 748 ), 749 array( 750 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month . '/' . $image_meta['sizes']['large']['file'], 751 'descriptor' => 'w', 752 'value' => $image_meta['sizes']['large']['width'], 753 ), 754 array( 755 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'], 756 'descriptor' => 'w', 757 'value' => $image_meta['width'], 758 ), 759 ); 742 $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; 743 744 $expected = $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' . 745 $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' . 746 $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w'; 760 747 761 748 // Set up test cases for all expected size names and a random one. … … 784 771 785 772 $image_meta = wp_get_attachment_metadata( $id ); 786 787 $expected = array( 788 array( 789 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['sizes']['medium']['file'], 790 'descriptor' => 'w', 791 'value' => $image_meta['sizes']['medium']['width'], 792 ), 793 array( 794 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['sizes']['large']['file'], 795 'descriptor' => 'w', 796 'value' => $image_meta['sizes']['large']['width'], 797 ), 798 array( 799 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'], 800 'descriptor' => 'w', 801 'value' => $image_meta['width'], 802 ), 803 ); 773 $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; 774 775 $expected = $uploads_dir_url . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' . 776 $uploads_dir_url . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' . 777 $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w'; 804 778 805 779 // Set up test cases for all expected size names and a random one. … … 836 810 837 811 // Calculate a srcset array. 838 $sizes = wp_calculate_image_srcset( $image_url, $size_array, $image_meta);812 $sizes = explode( ', ', wp_calculate_image_srcset( $image_url, $size_array, $image_meta ) ); 839 813 840 814 // Test to confirm all sources in the array include the same edit hash. 841 815 foreach ( $sizes as $size ) { 842 $this->assertTrue( false !== strpos( $size ['url'], $hash ) );816 $this->assertTrue( false !== strpos( $size, $hash ) ); 843 817 } 844 818 }
Note: See TracChangeset
for help on using the changeset viewer.