for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* Saito - The Threaded Web Forum
*
* @copyright Copyright (c) the Saito Project Developers
* @link https://github.com/Schlaefer/Saito
* @license http://opensource.org/licenses/MIT
*/
namespace Cron\Test;
use Cron\Lib\Cron;
use Saito\Test\SaitoTestCase;
class CronTest extends SaitoTestCase
{
public function testSimpleCronJobRun()
$cron = new Cron();
$mock = $this->getMockBuilder('stdClass')
->setMethods(['callback'])
->getMock();
$mock->expects($this->exactly(2))->method('callback');
$cron->addCronJob('foo', '+1 day', [$mock, 'callback']);
$mock->expects($this->exactly(3))->method('callback');
$cron->addCronJob('bar', '-1 day', [$mock, 'callback']);
$cron->execute();
$cron->clearHistory();
}