Completed
Branch hotfix/5.4.1 (9732a4)
by Schlaefer
02:32
created

CronTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSimpleCronJobRun() 0 20 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Saito - The Threaded Web Forum
7
 *
8
 * @copyright Copyright (c) the Saito Project Developers
9
 * @link https://github.com/Schlaefer/Saito
10
 * @license http://opensource.org/licenses/MIT
11
 */
12
13
namespace Cron\Test;
14
15
use Cron\Lib\Cron;
16
use Saito\Test\SaitoTestCase;
17
18
class CronTest extends SaitoTestCase
19
{
20
    public function testSimpleCronJobRun()
21
    {
22
        $cron = new Cron();
23
        $mock = $this->getMockBuilder('stdClass')
24
            ->setMethods(['callback'])
25
            ->getMock();
26
        $mock->expects($this->exactly(2))->method('callback');
27
        $cron->addCronJob('foo', '+1 day', [$mock, 'callback']);
28
29
        $mock = $this->getMockBuilder('stdClass')
30
            ->setMethods(['callback'])
31
            ->getMock();
32
        $mock->expects($this->exactly(3))->method('callback');
33
        $cron->addCronJob('bar', '-1 day', [$mock, 'callback']);
34
35
        $cron->execute();
36
        $cron->execute();
37
        $cron->clearHistory();
38
        $cron->execute();
39
    }
40
}
41