Changeset 41229
- Timestamp:
- 08/04/2017 02:05:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r40892 r41229 666 666 667 667 /** 668 * @ticket 35367669 * @depends test_video_shortcode_body670 */671 function test_wp_video_shortcode_with_empty_params() {672 $this->assertNull( wp_video_shortcode( array() ) );673 }674 675 /**676 * @ticket 35367677 * @depends test_video_shortcode_body678 */679 function test_wp_video_shortcode_with_bad_attr() {680 $this->assertSame(681 '<a class="wp-embedded-video" href="https://example.com/foo.php">https://example.com/foo.php</a>',682 wp_video_shortcode( array(683 'src' => 'https://example.com/foo.php',684 ) )685 );686 }687 688 /**689 * @ticket 35367690 * @depends test_video_shortcode_body691 */692 function test_wp_video_shortcode_attributes() {693 $actual = wp_video_shortcode( array(694 'src' => 'https://example.com/foo.mp4',695 ) );696 697 $this->assertContains( 'src="https://example.com/foo.mp4', $actual );698 $this->assertNotContains( 'loop', $actual );699 $this->assertNotContains( 'autoplay', $actual );700 $this->assertContains( 'preload="metadata"', $actual );701 $this->assertContains( 'width="640"', $actual );702 $this->assertContains( 'height="360"', $actual );703 $this->assertContains( 'class="wp-video-shortcode"', $actual );704 705 $actual = wp_video_shortcode( array(706 'src' => 'https://example.com/foo.mp4',707 'poster' => 'https://example.com/foo.png',708 'loop' => true,709 'autoplay' => true,710 'preload' => true,711 'width' => 123,712 'height' => 456,713 'class' => 'foobar',714 ) );715 716 $this->assertContains( 'src="https://example.com/foo.mp4', $actual );717 $this->assertContains( 'poster="https://example.com/foo.png', $actual );718 $this->assertContains( 'loop="1"', $actual );719 $this->assertContains( 'autoplay="1"', $actual );720 $this->assertContains( 'preload="1"', $actual );721 $this->assertContains( 'width="123"', $actual );722 $this->assertContains( 'height="456"', $actual );723 $this->assertContains( 'class="foobar"', $actual );724 }725 726 /**727 * @ticket 40866728 * @depends test_video_shortcode_body729 */730 function test_wp_video_shortcode_youtube_remove_feature() {731 $actual = wp_video_shortcode( array(732 'src' => 'https://www.youtube.com/watch?v=i_cVJgIz_Cs&feature=youtu.be',733 ) );734 735 $this->assertNotContains( 'feature=youtu.be', $actual );736 }737 738 /**739 * @ticket 40866740 * @depends test_video_shortcode_body741 */742 function test_wp_video_shortcode_youtube_force_ssl() {743 $actual = wp_video_shortcode( array(744 'src' => 'http://www.youtube.com/watch?v=i_cVJgIz_Cs',745 ) );746 747 $this->assertContains( 'src="https://www.youtube.com/watch?v=i_cVJgIz_Cs', $actual );748 }749 750 /**751 * @ticket 40866752 * @depends test_video_shortcode_body753 */754 function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() {755 $actual = wp_video_shortcode( array(756 'src' => 'http://vimeo.com/190372437?blah=meh',757 ) );758 759 $this->assertContains( 'src="https://vimeo.com/190372437', $actual );760 $this->assertNotContains( 'blah=meh', $actual );761 }762 763 /**764 * @ticket 40977765 * @depends test_video_shortcode_body766 */767 function test_wp_video_shortcode_vimeo_adds_loop() {768 $actual = wp_video_shortcode( array(769 'src' => 'http://vimeo.com/190372437',770 ) );771 772 $this->assertContains( 'src="https://vimeo.com/190372437?loop=0', $actual );773 }774 775 /**776 * @ticket 40977777 * @depends test_video_shortcode_body778 */779 function test_wp_video_shortcode_vimeo_force_adds_loop_true() {780 $actual = wp_video_shortcode( array(781 'src' => 'http://vimeo.com/190372437',782 'loop' => true,783 ) );784 785 $this->assertContains( 'src="https://vimeo.com/190372437?loop=1', $actual );786 }787 788 /**789 668 * Test [video] shortcode processing 790 669 * … … 831 710 832 711 $this->assertEquals( $expected, $content ); 712 } 713 714 /** 715 * @ticket 35367 716 * @depends test_video_shortcode_body 717 */ 718 function test_wp_video_shortcode_with_empty_params() { 719 $this->assertNull( wp_video_shortcode( array() ) ); 720 } 721 722 /** 723 * @ticket 35367 724 * @depends test_video_shortcode_body 725 */ 726 function test_wp_video_shortcode_with_bad_attr() { 727 $this->assertSame( 728 '<a class="wp-embedded-video" href="https://example.com/foo.php">https://example.com/foo.php</a>', 729 wp_video_shortcode( array( 730 'src' => 'https://example.com/foo.php', 731 ) ) 732 ); 733 } 734 735 /** 736 * @ticket 35367 737 * @depends test_video_shortcode_body 738 */ 739 function test_wp_video_shortcode_attributes() { 740 $actual = wp_video_shortcode( array( 741 'src' => 'https://example.com/foo.mp4', 742 ) ); 743 744 $this->assertContains( 'src="https://example.com/foo.mp4', $actual ); 745 $this->assertNotContains( 'loop', $actual ); 746 $this->assertNotContains( 'autoplay', $actual ); 747 $this->assertContains( 'preload="metadata"', $actual ); 748 $this->assertContains( 'width="640"', $actual ); 749 $this->assertContains( 'height="360"', $actual ); 750 $this->assertContains( 'class="wp-video-shortcode"', $actual ); 751 752 $actual = wp_video_shortcode( array( 753 'src' => 'https://example.com/foo.mp4', 754 'poster' => 'https://example.com/foo.png', 755 'loop' => true, 756 'autoplay' => true, 757 'preload' => true, 758 'width' => 123, 759 'height' => 456, 760 'class' => 'foobar', 761 ) ); 762 763 $this->assertContains( 'src="https://example.com/foo.mp4', $actual ); 764 $this->assertContains( 'poster="https://example.com/foo.png', $actual ); 765 $this->assertContains( 'loop="1"', $actual ); 766 $this->assertContains( 'autoplay="1"', $actual ); 767 $this->assertContains( 'preload="1"', $actual ); 768 $this->assertContains( 'width="123"', $actual ); 769 $this->assertContains( 'height="456"', $actual ); 770 $this->assertContains( 'class="foobar"', $actual ); 771 } 772 773 /** 774 * @ticket 40866 775 * @depends test_video_shortcode_body 776 */ 777 function test_wp_video_shortcode_youtube_remove_feature() { 778 $actual = wp_video_shortcode( array( 779 'src' => 'https://www.youtube.com/watch?v=i_cVJgIz_Cs&feature=youtu.be', 780 ) ); 781 782 $this->assertNotContains( 'feature=youtu.be', $actual ); 783 } 784 785 /** 786 * @ticket 40866 787 * @depends test_video_shortcode_body 788 */ 789 function test_wp_video_shortcode_youtube_force_ssl() { 790 $actual = wp_video_shortcode( array( 791 'src' => 'http://www.youtube.com/watch?v=i_cVJgIz_Cs', 792 ) ); 793 794 $this->assertContains( 'src="https://www.youtube.com/watch?v=i_cVJgIz_Cs', $actual ); 795 } 796 797 /** 798 * @ticket 40866 799 * @depends test_video_shortcode_body 800 */ 801 function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() { 802 $actual = wp_video_shortcode( array( 803 'src' => 'http://vimeo.com/190372437?blah=meh', 804 ) ); 805 806 $this->assertContains( 'src="https://vimeo.com/190372437', $actual ); 807 $this->assertNotContains( 'blah=meh', $actual ); 808 } 809 810 /** 811 * @ticket 40977 812 * @depends test_video_shortcode_body 813 */ 814 function test_wp_video_shortcode_vimeo_adds_loop() { 815 $actual = wp_video_shortcode( array( 816 'src' => 'http://vimeo.com/190372437', 817 ) ); 818 819 $this->assertContains( 'src="https://vimeo.com/190372437?loop=0', $actual ); 820 } 821 822 /** 823 * @ticket 40977 824 * @depends test_video_shortcode_body 825 */ 826 function test_wp_video_shortcode_vimeo_force_adds_loop_true() { 827 $actual = wp_video_shortcode( array( 828 'src' => 'http://vimeo.com/190372437', 829 'loop' => true, 830 ) ); 831 832 $this->assertContains( 'src="https://vimeo.com/190372437?loop=1', $actual ); 833 833 } 834 834
Note: See TracChangeset
for help on using the changeset viewer.