コード例 #1
0
 public function schedule()
 {
     $alerts = new CustomAlerts();
     $siteIds = $alerts->getSiteIdsHavingAlerts();
     foreach ($siteIds as $idSite) {
         $timezoneForSite = Site::getTimezoneFor($idSite);
         $scheduledTime = $this->daily('runAlertsDaily', $idSite);
         $scheduledTime->setTimezone($timezoneForSite);
         $scheduledTime = $this->weekly('runAlertsWeekly', $idSite);
         $scheduledTime->setTimezone($timezoneForSite);
         $scheduledTime = $this->monthly('runAlertsMonthly', $idSite);
         $scheduledTime->setTimezone($timezoneForSite);
     }
 }
コード例 #2
0
 public function test_deleteAlertsForLogin()
 {
     $this->createAlert('Initial1', array(), array(), 'testlogin1');
     $this->createAlert('Initial2', array(), array(), 'testlogin2');
     $this->createAlert('Initial3', array(), array(), 'testlogin3');
     $this->createAlert('Initial4', array(), array(), 'testlogin2');
     $this->createAlert('Initial5', array(), array(), 'testlogin2');
     $this->createAlert('Initial6', array(), array(), 'testlogin1');
     $this->plugin->deleteAlertsForLogin('testlogin2');
     $alerts = $this->model->getAllAlerts();
     $this->assertCount(3, $alerts);
     $this->assertEquals('Initial1', $alerts[0]['name']);
     $this->assertEquals('Initial3', $alerts[1]['name']);
     $this->assertEquals('Initial6', $alerts[2]['name']);
 }