public function test_release_claim()
 {
     $created_actions = array();
     $store = new ActionScheduler_wpPostStore();
     for ($i = 0; $i > -3; $i--) {
         $time = new DateTime($i . ' hours');
         $schedule = new ActionScheduler_SimpleSchedule($time);
         $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group');
         $created_actions[] = $store->save_action($action);
     }
     $claim1 = $store->stake_claim();
     $store->release_claim($claim1);
     $claim2 = $store->stake_claim();
     $this->assertCount(3, $claim2->get_actions());
 }
 public function test_batch_count_limit()
 {
     $store = new ActionScheduler_wpPostStore();
     $runner = new ActionScheduler_QueueRunner($store);
     $mock = new MockAction();
     $random = md5(rand());
     add_action($random, array($mock, 'action'));
     $schedule = new ActionScheduler_SimpleSchedule(new DateTime('1 day ago'));
     for ($i = 0; $i < 30; $i++) {
         $action = new ActionScheduler_Action($random, array($random), $schedule);
         $store->save_action($action);
     }
     $claims = array();
     for ($i = 0; $i < 5; $i++) {
         $claims[] = $store->stake_claim(5);
     }
     $actions_run = $runner->run();
     $this->assertEquals(0, $mock->get_call_count());
     $this->assertEquals(0, $actions_run);
     $first = reset($claims);
     $store->release_claim($first);
     $actions_run = $runner->run();
     $this->assertEquals(10, $mock->get_call_count());
     $this->assertEquals(10, $actions_run);
     remove_action($random, array($mock, 'action'));
 }