Beispiel #1
0
 public function testRunActuallyRunsSingleTask()
 {
     CronManager::schedule('task1', '5 minutes', function () {
         return true;
     });
     CronManager::schedule('task2', '5 minutes', function () {
         return true;
     });
     $current_time = strtotime('10:45:05');
     $result = CronManager::run('task1', false, $current_time);
     $this->assertTrue(strpos($result, 'task1') !== false);
     $this->assertTrue(strpos($result, 'Done') !== false);
     $this->assertTrue(strpos($result, 'task2') === false);
 }
Beispiel #2
0
 * @license     http://opensource.org/licenses/MIT  (MIT)
 * @link        http://sprintphp.com
 * @since       Version 1.0
 */
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
use Myth\Cron\CronManager;
/**
 * Cron Specification File.
 *
 * This file should contain the complete list of all scheduled tasks (cron jobs)
 * that your site might need to perform. You can include other files from within
 * this file if you desire a different organization to your tasks.
 *
 * Cron jobs are specified by calling CronManager::schedule().
 *
 * Example:
 *      CronManager::schedule('taskName', 'interval', callable() );
 *
 * See the docs for details.
 */
CronManager::schedule('task1', '1 minutes', function () {
    return true;
});
CronManager::schedule('task2 with a really long name that wont show well', '5 minutes', function () {
    return true;
});
// Process the mail queue every 5 minutes
CronManager::schedule('process_mail_queue', '5 minutes', '\\Myth\\Mail\\Mail::process');