mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Date/Time: Bring some consistency to the_date() and the_weekday_date():
* Make `the_date()` always apply the the filter and return a value. * Use `is_new_day()` in `the_weekday_date()`. * Add a unit test for `the_weekday_date()`. Fixes #47354. git-svn-id: https://develop.svn.wordpress.org/trunk@45378 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -915,46 +915,6 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
$this->assertFalse( $json );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33750
|
||||
*/
|
||||
function test_the_date() {
|
||||
ob_start();
|
||||
the_date();
|
||||
$actual = ob_get_clean();
|
||||
$this->assertEquals( '', $actual );
|
||||
|
||||
$GLOBALS['post'] = self::factory()->post->create_and_get(
|
||||
array(
|
||||
'post_date' => '2015-09-16 08:00:00',
|
||||
)
|
||||
);
|
||||
|
||||
ob_start();
|
||||
$GLOBALS['currentday'] = '18.09.15';
|
||||
$GLOBALS['previousday'] = '17.09.15';
|
||||
the_date();
|
||||
$this->assertEquals( 'September 16, 2015', ob_get_clean() );
|
||||
|
||||
ob_start();
|
||||
$GLOBALS['currentday'] = '18.09.15';
|
||||
$GLOBALS['previousday'] = '17.09.15';
|
||||
the_date( 'Y' );
|
||||
$this->assertEquals( '2015', ob_get_clean() );
|
||||
|
||||
ob_start();
|
||||
$GLOBALS['currentday'] = '18.09.15';
|
||||
$GLOBALS['previousday'] = '17.09.15';
|
||||
the_date( 'Y', 'before ', ' after' );
|
||||
$this->assertEquals( 'before 2015 after', ob_get_clean() );
|
||||
|
||||
ob_start();
|
||||
$GLOBALS['currentday'] = '18.09.15';
|
||||
$GLOBALS['previousday'] = '17.09.15';
|
||||
the_date( 'Y', 'before ', ' after', false );
|
||||
$this->assertEquals( '', ob_get_clean() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36054
|
||||
* @dataProvider datetime_provider
|
||||
|
||||
Reference in New Issue
Block a user