| 674 | |
| 675 | /** |
| 676 | * @ticket 33750 |
| 677 | */ |
| 678 | function test_the_date() { |
| 679 | |
| 680 | ob_start(); |
| 681 | the_date(); |
| 682 | $actual = ob_get_clean(); |
| 683 | $this->assertEquals( '', $actual ); |
| 684 | |
| 685 | $GLOBALS['post'] = $this->factory->post->create_and_get( array( |
| 686 | 'post_date' => '2015-09-16 08:00:00' |
| 687 | ) ); |
| 688 | |
| 689 | ob_start(); |
| 690 | $GLOBALS['currentday'] = '18.09.15'; |
| 691 | $GLOBALS['previousday'] = '17.09.15'; |
| 692 | the_date(); |
| 693 | $actual = ob_get_clean(); |
| 694 | $this->assertEquals( 'September 16, 2015', $actual ); |
| 695 | |
| 696 | ob_start(); |
| 697 | $GLOBALS['currentday'] = '18.09.15'; |
| 698 | $GLOBALS['previousday'] = '17.09.15'; |
| 699 | the_date( 'Y' ); |
| 700 | $actual = ob_get_clean(); |
| 701 | $this->assertEquals( '2015', $actual ); |
| 702 | |
| 703 | ob_start(); |
| 704 | $GLOBALS['currentday'] = '18.09.15'; |
| 705 | $GLOBALS['previousday'] = '17.09.15'; |
| 706 | the_date( 'Y', 'before ', ' after' ); |
| 707 | $actual = ob_get_clean(); |
| 708 | $this->assertEquals( 'before 2015 after', $actual ); |
| 709 | |
| 710 | ob_start(); |
| 711 | $GLOBALS['currentday'] = '18.09.15'; |
| 712 | $GLOBALS['previousday'] = '17.09.15'; |
| 713 | the_date( 'Y', 'before ', ' after', false ); |
| 714 | $actual = ob_get_clean(); |
| 715 | $this->assertEquals( '', $actual ); |
| 716 | |
| 717 | |
| 718 | |
| 719 | } |