wordpress-develop/tests/phpunit/tests/functions/getWeekstartend.php
Sergey Biryukov 2a6b527f73 Tests: Improve the @group annotation accuracy and consistency.
Includes removing `.php` from some older group names, because most of the groups are no longer named based on the file containing the function, and sometimes functions move around, making the file-based group name inaccurate.

Props afercia, aristath, poena, SergeyBiryukov.
See #59647.

git-svn-id: https://develop.svn.wordpress.org/trunk@56971 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-19 13:51:04 +00:00

50 lines
1.1 KiB
PHP

<?php
/**
* @group functions
*
* @covers ::get_weekstartend
*/
class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
public function test_default_start_of_week_option_is_monday() {
$expected = array(
'start' => 1454889600,
'end' => 1455494399,
);
$this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
public function test_start_of_week_sunday() {
$expected = array(
'start' => 1454803200,
'end' => 1455407999,
);
$this->assertSame( $expected, get_weekstartend( '2016-02-12', 0 ) );
}
public function test_start_of_week_should_fall_back_on_start_of_week_option() {
update_option( 'start_of_week', 2 );
$expected = array(
'start' => 1454976000,
'end' => 1455580799,
);
$this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
public function test_start_of_week_should_fall_back_on_sunday_when_option_is_missing() {
delete_option( 'start_of_week' );
$expected = array(
'start' => 1454803200,
'end' => 1455407999,
);
$this->assertSame( $expected, get_weekstartend( '2016-02-12' ) );
}
}