Changeset 48209 for trunk/tests/phpunit/tests/general/template.php
- Timestamp:
- 06/28/2020 11:08:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/template.php
r47288 r48209 632 632 * @ticket 40969 633 633 */ 634 function test_get_template_part_returns_nothing() { 635 ob_start(); 634 function test_get_header_returns_nothing_on_success() { 635 $this->expectOutputRegex( '/Header/' ); 636 637 // The `get_header()` function must not return anything 638 // due to themes in the wild that may echo its return value. 639 $this->assertNull( get_header() ); 640 } 641 642 /** 643 * @ticket 40969 644 */ 645 function test_get_footer_returns_nothing_on_success() { 646 $this->expectOutputRegex( '/Footer/' ); 647 648 // The `get_footer()` function must not return anything 649 // due to themes in the wild that may echo its return value. 650 $this->assertNull( get_footer() ); 651 } 652 653 /** 654 * @ticket 40969 655 */ 656 function test_get_sidebar_returns_nothing_on_success() { 657 $this->expectOutputRegex( '/Sidebar/' ); 658 659 // The `get_sidebar()` function must not return anything 660 // due to themes in the wild that may echo its return value. 661 $this->assertNull( get_sidebar() ); 662 } 663 664 /** 665 * @ticket 40969 666 */ 667 function test_get_template_part_returns_nothing_on_success() { 668 $this->expectOutputRegex( '/Template Part/' ); 636 669 637 670 // The `get_template_part()` function must not return anything 638 671 // due to themes in the wild that echo its return value. 639 $part = get_template_part( 'template', 'part' ); 640 $output = ob_get_clean(); 641 642 self::assertSame( 'Template Part', trim( $output ) ); 643 self::assertSame( null, $part ); 672 $this->assertNull( get_template_part( 'template', 'part' ) ); 673 } 674 675 /** 676 * @ticket 40969 677 */ 678 function test_get_template_part_returns_false_on_failure() { 679 $this->assertFalse( get_template_part( 'non-existing-template' ) ); 644 680 } 645 681 }
Note: See TracChangeset
for help on using the changeset viewer.