Skip to content
Snippets Groups Projects
Select Git revision
  • 1bdb01ebff7a806e02e29c4e73adaec2536110e3
  • main default protected
  • register-logging-channel
  • expr-lang
  • ci-82
  • attr-events
  • locale-wip
  • custom-routes
  • v0.1.85
  • v0.1.84
  • v0.1.83
  • v0.1.82
  • v0.1.81
  • v0.1.80
  • v0.1.79
  • v0.1.78
  • v0.1.77
  • v0.1.76
  • v0.1.75
  • v0.1.74
  • v0.1.73
  • v0.1.72
  • v0.1.71
  • v0.1.70
  • v0.1.69
  • v0.1.68
  • v0.1.67
  • v0.1.65
28 results

CronTest.php

Blame
  • Christoph Reiter's avatar
    Reiter, Christoph authored
    splitting it out of the cron command.
    Makes it a bit clearer
    1bdb01eb
    History
    CronTest.php 878 B
    <?php
    
    declare(strict_types=1);
    
    namespace Dbp\Relay\CoreBundle\Tests\Cron;
    
    use Dbp\Relay\CoreBundle\Cron\CronManager;
    use PHPUnit\Framework\TestCase;
    
    class CronTest extends TestCase
    {
        public function testCronisDue()
        {
            $isDue = CronManager::isDue(new \DateTimeImmutable('2021-09-07T09:36:26Z'), new \DateTimeImmutable('2021-09-07T09:36:26Z'), '* * * * *');
            $this->assertFalse($isDue);
            $isDue = CronManager::isDue(new \DateTimeImmutable('2021-09-07T09:35:59Z'), new \DateTimeImmutable('2021-09-07T09:36:00Z'), '* * * * *');
            $this->assertTrue($isDue);
            $isDue = CronManager::isDue(null, new \DateTimeImmutable('2021-09-07T09:36:00Z'), '0 0 1 1 *');
            $this->assertTrue($isDue);
            $isDue = CronManager::isDue(null, new \DateTimeImmutable('2021-09-07T09:36:00Z'), '* * * * *');
            $this->assertTrue($isDue);
        }
    }