- Timestamp:
- 10/27/2017 05:04:04 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets/media-image-widget.php
r41549 r42030 426 426 $this->assertContains( 'target="_blank"', $output ); 427 427 428 // Caption settings.428 // Populate caption in attachment. 429 429 wp_update_post( array( 430 430 'ID' => $attachment_id, … … 432 432 ) ); 433 433 434 ob_start(); 435 $widget->render_media( array( 436 'attachment_id' => $attachment_id, 437 ) ); 438 $output = ob_get_clean(); 439 434 // If no caption is supplied, then the default is '', and so the caption will not be displayed. 435 ob_start(); 436 $widget->render_media( array( 437 'attachment_id' => $attachment_id, 438 ) ); 439 $output = ob_get_clean(); 440 $this->assertNotContains( 'wp-caption', $output ); 441 $this->assertNotContains( '<p class="wp-caption-text">', $output ); 442 443 // If the caption is explicitly null, then the caption of the underlying attachment will be displayed. 444 ob_start(); 445 $widget->render_media( array( 446 'attachment_id' => $attachment_id, 447 'caption' => null, 448 ) ); 449 $output = ob_get_clean(); 440 450 $this->assertContains( 'class="wp-caption alignnone"', $output ); 441 451 $this->assertContains( '<p class="wp-caption-text">Default caption</p>', $output ); 442 452 453 // If caption is provided, then it will be displayed. 443 454 ob_start(); 444 455 $widget->render_media( array( … … 447 458 ) ); 448 459 $output = ob_get_clean(); 449 450 460 $this->assertContains( 'class="wp-caption alignnone"', $output ); 451 461 $this->assertContains( '<p class="wp-caption-text">Custom caption</p>', $output );
Note: See TracChangeset
for help on using the changeset viewer.