From 0d7d252b564bc4f7ea54c5710324c758a587815a Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 17 Nov 2017 14:33:35 +0100 Subject: [PATCH] Improve taskschedule tests and implementation --- DataStorage/Session/ConsoleSession.php | 7 +++++++ DataStorage/Session/SocketSession.php | 7 +++++++ Utils/TaskSchedule/Cron.php | 1 + Utils/TaskSchedule/SchedulerAbstract.php | 1 + Utils/TaskSchedule/TaskAbstract.php | 23 +++++++++++------------ Utils/TaskSchedule/TaskScheduler.php | 1 + 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/DataStorage/Session/ConsoleSession.php b/DataStorage/Session/ConsoleSession.php index 479a735d7..b4a863251 100644 --- a/DataStorage/Session/ConsoleSession.php +++ b/DataStorage/Session/ConsoleSession.php @@ -93,4 +93,11 @@ class ConsoleSession implements SessionInterface { } + /** + * {@inheritdoc} + */ + public function lock() + { + } + } diff --git a/DataStorage/Session/SocketSession.php b/DataStorage/Session/SocketSession.php index 7aa0ecd89..1b4b9bace 100644 --- a/DataStorage/Session/SocketSession.php +++ b/DataStorage/Session/SocketSession.php @@ -93,4 +93,11 @@ class SocketSession implements SessionInterface { } + /** + * {@inheritdoc} + */ + public function lock() + { + } + } diff --git a/Utils/TaskSchedule/Cron.php b/Utils/TaskSchedule/Cron.php index dc63d7387..99041e06b 100644 --- a/Utils/TaskSchedule/Cron.php +++ b/Utils/TaskSchedule/Cron.php @@ -23,6 +23,7 @@ namespace phpOMS\Utils\TaskSchedule; * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 + * @codeCoverageIgnore */ class Cron extends SchedulerAbstract { diff --git a/Utils/TaskSchedule/SchedulerAbstract.php b/Utils/TaskSchedule/SchedulerAbstract.php index 54eace04e..5445f320d 100644 --- a/Utils/TaskSchedule/SchedulerAbstract.php +++ b/Utils/TaskSchedule/SchedulerAbstract.php @@ -79,6 +79,7 @@ abstract class SchedulerAbstract * @return bool * * @since 1.0.0 + * @codeCoverageIgnore */ public static function test() : bool { diff --git a/Utils/TaskSchedule/TaskAbstract.php b/Utils/TaskSchedule/TaskAbstract.php index 23d672b54..d1dceebf7 100644 --- a/Utils/TaskSchedule/TaskAbstract.php +++ b/Utils/TaskSchedule/TaskAbstract.php @@ -85,9 +85,20 @@ abstract class TaskAbstract */ protected $comment = ''; + /** + * Constructor + * + * @param string $name Id/name of the task (on linux the same as the executable script) + * @param string $cmd Command to create the task + * + * @since 1.0.0 + */ public function __construct(string $name, string $cmd = '') { $this->id = $name; $this->command = $cmd; + + $this->lastRunTime = new \DateTime('1900-01-01'); + $this->nextRunTime = new \DateTime('1900-01-01'); } /** @@ -258,18 +269,6 @@ abstract class TaskAbstract $this->comment = $comment; } - /** - * Get comment. - * - * @return string - * - * @since 1.0.0 - */ - public function addResult(string $result) - { - $this->results[] = $result; - } - /** * Create task based on job data * diff --git a/Utils/TaskSchedule/TaskScheduler.php b/Utils/TaskSchedule/TaskScheduler.php index fa97747fb..652ebfc39 100644 --- a/Utils/TaskSchedule/TaskScheduler.php +++ b/Utils/TaskSchedule/TaskScheduler.php @@ -25,6 +25,7 @@ use phpOMS\Validation\Base\DateTime; * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 + * @codeCoverageIgnore */ class TaskScheduler extends SchedulerAbstract {