<?php
/**
 * Orange Management
 *
 * PHP Version 7.2
 *
 * @package    TBD
 * @copyright  Dennis Eichhorn
 * @license    OMS License 1.0
 * @version    1.0.0
 * @link       http://website.orange-management.de
 */

namespace phpOMS\tests\Utils\TaskSchedule;

use phpOMS\Utils\TaskSchedule\TaskAbstract;

class TaskAbstractTest extends \PHPUnit\Framework\TestCase
{
    private $class = null;

    protected function setUp()
    {
        $this->class = new class('') extends TaskAbstract {
            public function __toString() : string
            {
                return '';
            }

            public static function createWith(array $jobData) : TaskAbstract
            {

            }
        };
    }

    public function testDefault()
    {
        self::assertEquals('', $this->class->getId());
        self::assertEquals('', $this->class->getCommand());
        self::assertEquals('', $this->class->getStatus());
        self::assertInstanceOf('\DateTime', $this->class->getNextRunTime());
        self::assertInstanceOf('\DateTime', $this->class->getLastRuntime());
        self::assertEquals('', $this->class->getComment());
    }

    public function testGetSet()
    {
        $this->class->setCommand('Command');
        self::assertEquals('Command', $this->class->getCommand());

        $this->class->setStatus('Status');
        self::assertEquals('Status', $this->class->getStatus());

        $this->class->setComment('Comment');
        self::assertEquals('Comment', $this->class->getComment());

        $date = new \DateTime('now');
        $this->class->setLastRuntime($date);
        self::assertEquals($date->format('Y-m-d'), $this->class->getLastRuntime()->format('Y-m-d'));

        $this->class->setNextRuntime($date);
        self::assertEquals($date->format('Y-m-d'), $this->class->getNextRuntime()->format('Y-m-d'));
    }
}
