Improve taskschedule tests and implementation

This commit is contained in:
Dennis Eichhorn 2017-11-17 14:33:35 +01:00
parent 3251816b80
commit 0d7d252b56
6 changed files with 28 additions and 12 deletions

View File

@ -93,4 +93,11 @@ class ConsoleSession implements SessionInterface
{
}
/**
* {@inheritdoc}
*/
public function lock()
{
}
}

View File

@ -93,4 +93,11 @@ class SocketSession implements SessionInterface
{
}
/**
* {@inheritdoc}
*/
public function lock()
{
}
}

View File

@ -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
{

View File

@ -79,6 +79,7 @@ abstract class SchedulerAbstract
* @return bool
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public static function test() : bool
{

View File

@ -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
*

View File

@ -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
{