6
6
*/
7
7
class ActionScheduler_Action_Test extends ActionScheduler_UnitTestCase {
8
8
public function test_set_schedule () {
9
- $ time = as_get_datetime_object ();
10
- $ schedule = new ActionScheduler_SimpleSchedule ($ time );
11
- $ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK , array (), $ schedule );
9
+ $ time = as_get_datetime_object ();
10
+ $ schedule = new ActionScheduler_SimpleSchedule ( $ time );
11
+ $ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK , array (), $ schedule );
12
12
$ this ->assertEquals ( $ schedule , $ action ->get_schedule () );
13
13
}
14
14
@@ -24,31 +24,31 @@ public function test_set_hook() {
24
24
25
25
public function test_args () {
26
26
$ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK );
27
- $ this ->assertEmpty ($ action ->get_args ());
27
+ $ this ->assertEmpty ( $ action ->get_args () );
28
28
29
29
$ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK , array ( 5 , 10 , 15 ) );
30
- $ this ->assertEqualSets (array (5 , 10 ,15 ), $ action ->get_args ());
30
+ $ this ->assertEqualSets ( array ( 5 , 10 , 15 ), $ action ->get_args () );
31
31
}
32
32
33
33
public function test_set_group () {
34
- $ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK , array (), NULL , 'my_group ' );
35
- $ this ->assertEquals ('my_group ' , $ action ->get_group ());
34
+ $ action = new ActionScheduler_Action ( ActionScheduler_Callbacks::HOOK_WITH_CALLBACK , array (), null , 'my_group ' );
35
+ $ this ->assertEquals ( 'my_group ' , $ action ->get_group () );
36
36
}
37
37
38
38
public function test_execute () {
39
39
$ mock = new MockAction ();
40
40
41
- $ random = md5 (rand () );
41
+ $ random = md5 ( wp_rand () );
42
42
add_action ( $ random , array ( $ mock , 'action ' ) );
43
43
44
- $ action = new ActionScheduler_Action ( $ random , array ($ random ) );
44
+ $ action = new ActionScheduler_Action ( $ random , array ( $ random ) );
45
45
$ action ->execute ();
46
46
47
47
remove_action ( $ random , array ( $ mock , 'action ' ) );
48
48
49
49
$ this ->assertEquals ( 1 , $ mock ->get_call_count () );
50
50
$ events = $ mock ->get_events ();
51
- $ event = reset ($ events );
52
- $ this ->assertEquals ( $ random , reset ($ event ['args ' ]) );
51
+ $ event = reset ( $ events );
52
+ $ this ->assertEquals ( $ random , reset ( $ event ['args ' ] ) );
53
53
}
54
54
}
0 commit comments