Changeset 36240 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 01/09/2016 02:17:02 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r36121 r36240 416 416 $matches2 = get_media_embedded_in_content( $reversed, array( 'audio', 'video' ) ); 417 417 $this->assertEquals( array( $video, $audio ), $matches2 ); 418 } 419 420 /** 421 * @ticket 35367 422 */ 423 function test_wp_audio_shortcode_with_empty_params() { 424 $this->assertNull( wp_audio_shortcode( array() ) ); 425 } 426 427 /** 428 * @ticket 35367 429 */ 430 function test_wp_audio_shortcode_with_bad_attr() { 431 $this->assertSame( 432 '<a class="wp-embedded-audio" href="https://example.com/foo.php">https://example.com/foo.php</a>', 433 wp_audio_shortcode( array( 434 'src' => 'https://example.com/foo.php', 435 ) ) 436 ); 437 } 438 439 /** 440 * @ticket 35367 441 */ 442 function test_wp_audio_shortcode_attributes() { 443 $actual = wp_audio_shortcode( array( 444 'src' => 'https://example.com/foo.mp3', 445 ) ); 446 447 $this->assertContains( 'src="https://example.com/foo.mp3', $actual ); 448 $this->assertNotContains( 'loop', $actual ); 449 $this->assertNotContains( 'autoplay', $actual ); 450 $this->assertContains( 'preload="none"', $actual ); 451 $this->assertContains( 'class="wp-audio-shortcode"', $actual ); 452 $this->assertContains( 'style="width: 100%; visibility: hidden;"', $actual ); 453 454 $actual = wp_audio_shortcode( array( 455 'src' => 'https://example.com/foo.mp3', 456 'loop' => true, 457 'autoplay' => true, 458 'preload' => true, 459 'class' => 'foobar', 460 'style' => 'padding:0;', 461 ) ); 462 463 $this->assertContains( 'src="https://example.com/foo.mp3', $actual ); 464 $this->assertContains( 'loop="1"', $actual ); 465 $this->assertContains( 'autoplay="1"', $actual ); 466 $this->assertContains( 'preload="1"', $actual ); 467 $this->assertContains( 'class="foobar"', $actual ); 468 $this->assertContains( 'style="padding:0;"', $actual ); 469 } 470 471 /** 472 * @ticket 35367 473 * @depends test_video_shortcode_body 474 */ 475 function test_wp_video_shortcode_with_empty_params() { 476 $this->assertNull( wp_video_shortcode( array() ) ); 477 } 478 479 /** 480 * @ticket 35367 481 * @depends test_video_shortcode_body 482 */ 483 function test_wp_video_shortcode_with_bad_attr() { 484 $this->assertSame( 485 '<a class="wp-embedded-video" href="https://example.com/foo.php">https://example.com/foo.php</a>', 486 wp_video_shortcode( array( 487 'src' => 'https://example.com/foo.php', 488 ) ) 489 ); 490 } 491 492 /** 493 * @ticket 35367 494 * @depends test_video_shortcode_body 495 */ 496 function test_wp_video_shortcode_attributes() { 497 $actual = wp_video_shortcode( array( 498 'src' => 'https://example.com/foo.mp4', 499 ) ); 500 501 $this->assertContains( 'src="https://example.com/foo.mp4', $actual ); 502 $this->assertNotContains( 'loop', $actual ); 503 $this->assertNotContains( 'autoplay', $actual ); 504 $this->assertContains( 'preload="metadata"', $actual ); 505 $this->assertContains( 'width="640"', $actual ); 506 $this->assertContains( 'height="360"', $actual ); 507 $this->assertContains( 'class="wp-video-shortcode"', $actual ); 508 509 $actual = wp_video_shortcode( array( 510 'src' => 'https://example.com/foo.mp4', 511 'poster' => 'https://example.com/foo.png', 512 'loop' => true, 513 'autoplay' => true, 514 'preload' => true, 515 'width' => 123, 516 'height' => 456, 517 'class' => 'foobar', 518 ) ); 519 520 $this->assertContains( 'src="https://example.com/foo.mp4', $actual ); 521 $this->assertContains( 'poster="https://example.com/foo.png', $actual ); 522 $this->assertContains( 'loop="1"', $actual ); 523 $this->assertContains( 'autoplay="1"', $actual ); 524 $this->assertContains( 'preload="1"', $actual ); 525 $this->assertContains( 'width="123"', $actual ); 526 $this->assertContains( 'height="456"', $actual ); 527 $this->assertContains( 'class="foobar"', $actual ); 418 528 } 419 529
Note: See TracChangeset
for help on using the changeset viewer.