File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
tests/phpunit/tests/functions Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * @group functions.php
5
+ */
6
+ class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
7
+
8
+ public function test_default_start_of_week_option_is_monday () {
9
+ $ expected = array (
10
+ 'start ' => 1454889600 ,
11
+ 'end ' => 1455494399 ,
12
+ );
13
+
14
+ $ this ->assertEquals ( $ expected , get_weekstartend ( '2016-02-12 ' ) );
15
+ }
16
+
17
+ public function test_start_of_week_sunday () {
18
+ $ expected = array (
19
+ 'start ' => 1454803200 ,
20
+ 'end ' => 1455407999 ,
21
+ );
22
+
23
+ $ this ->assertEquals ( $ expected , get_weekstartend ( '2016-02-12 ' , 0 ) );
24
+ }
25
+
26
+ public function test_start_of_week_should_fall_back_on_start_of_week_option () {
27
+ update_option ( 'start_of_week ' , 2 );
28
+
29
+ $ expected = array (
30
+ 'start ' => 1454976000 ,
31
+ 'end ' => 1455580799 ,
32
+ );
33
+
34
+ $ this ->assertEquals ( $ expected , get_weekstartend ( '2016-02-12 ' ) );
35
+ }
36
+
37
+ public function test_start_of_week_should_fall_back_on_sunday_when_option_is_missing () {
38
+ delete_option ( 'start_of_week ' );
39
+
40
+ $ expected = array (
41
+ 'start ' => 1454803200 ,
42
+ 'end ' => 1455407999 ,
43
+ );
44
+
45
+ $ this ->assertEquals ( $ expected , get_weekstartend ( '2016-02-12 ' ) );
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments