Skip to content
Extraits de code Groupes Projets
Valider e65e378f rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #5301 this should fix the scheduledreports tests

parent 756d1e0d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -58,7 +58,7 @@ class Tasks
*/
protected function hourly($methodName, $methodParameter = null, $priority = self::NORMAL_PRIORITY)
{
return $this->custom($this, $methodName, $methodParameter, 'hourly', $priority);
return $this->custom(get_class($this), $methodName, $methodParameter, 'hourly', $priority);
}
/**
......@@ -69,7 +69,7 @@ class Tasks
*/
protected function daily($methodName, $methodParameter = null, $priority = self::NORMAL_PRIORITY)
{
return $this->custom($this, $methodName, $methodParameter, 'daily', $priority);
return $this->custom(get_class($this), $methodName, $methodParameter, 'daily', $priority);
}
/**
......@@ -80,7 +80,7 @@ class Tasks
*/
protected function weekly($methodName, $methodParameter = null, $priority = self::NORMAL_PRIORITY)
{
return $this->custom($this, $methodName, $methodParameter, 'weekly', $priority);
return $this->custom(get_class($this), $methodName, $methodParameter, 'weekly', $priority);
}
/**
......@@ -91,7 +91,7 @@ class Tasks
*/
protected function monthly($methodName, $methodParameter = null, $priority = self::NORMAL_PRIORITY)
{
return $this->custom($this, $methodName, $methodParameter, 'monthly', $priority);
return $this->custom(get_class($this), $methodName, $methodParameter, 'monthly', $priority);
}
/**
......@@ -122,10 +122,6 @@ class Tasks
throw new \Exception('$time should be an instance of ScheduledTime');
}
if (!is_string($objectOrClassName)) {
$objectOrClassName = get_class($objectOrClassName);
}
$this->scheduleTask(new ScheduledTask($objectOrClassName, $methodName, $methodParameter, $time, $priority));
return $time;
......
......@@ -10,6 +10,7 @@ use Piwik\Plugins\MobileMessaging\API as APIMobileMessaging;
use Piwik\Plugins\MobileMessaging\MobileMessaging;
use Piwik\Plugins\ScheduledReports\API as APIScheduledReports;
use Piwik\Plugins\ScheduledReports\Menu;
use Piwik\Plugins\ScheduledReports\Tasks;
use Piwik\Plugins\ScheduledReports\ScheduledReports;
use Piwik\Plugins\SitesManager\API as APISitesManager;
use Piwik\ScheduledTask;
......@@ -383,9 +384,9 @@ class Plugins_ScheduledReportsTest extends DatabaseTestCase
new ScheduledTask (APIScheduledReports::getInstance(), 'sendReport', 5, $scheduleTask4),
);
$pdfReportPlugin = new ScheduledReports();
$tasks = array();
$pdfReportPlugin->getScheduledTasks($tasks);
$pdfReportPlugin = new Tasks();
$pdfReportPlugin->schedule();
$tasks = $pdfReportPlugin->getScheduledTasks();
$this->assertEquals($expectedTasks, $tasks);
\Piwik\Plugins\ScheduledReports\API::unsetInstance();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter