コード例 #1
0
ファイル: crontab_test.php プロジェクト: Osub/crontab
 function test_remove_all_jobs()
 {
     $crontab = new Crontab($this->config);
     $times = array('0 * * * *', '0 12 * * *', '0 12 * 2 *');
     $action = 'test_remove_all';
     foreach ($times as $time) {
         $crontab->add_job($time, $action);
     }
     $file_items = explode("\n", read_file($crontab->cronfile));
     foreach ($times as $time) {
         $job = $time . ' ' . $crontab->php_path . ' ' . $crontab->cli_path . $action;
         $this->assertTrue(in_array($job, $file_items));
     }
     //actual test
     $crontab->remove_all_jobs($action);
     $file_items = explode("\n", read_file($crontab->cronfile));
     $job = $time . ' ' . $crontab->php_path . ' ' . $crontab->cli_path . $action;
     $this->assertFalse(in_array($job, $file_items));
 }