CronTest::testAdd()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Tests\FOA\CronBundle\Manager;
4
5
use FOA\CronBundle\Manager\Cron;
6
use InvalidArgumentException;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * @author JM Leroux <[email protected]>
11
 */
12
class CronTest extends TestCase
13
{
14
    public function testAdd()
15
    {
16
        $cron = new Cron();
17
        $cron->setCommand('my_command');
18
        $this->assertEquals('my_command', $cron->getCommand());
19
    }
20
21
    public function testParseValidCron()
22
    {
23
        $cron = Cron::parse('1 2 3 4 5 my_command');
24
        $this->assertEquals('1', $cron->getMinute());
25
        $this->assertEquals('2', $cron->getHour());
26
        $this->assertEquals('3', $cron->getDayOfMonth());
27
        $this->assertEquals('4', $cron->getMonth());
28
        $this->assertEquals('5', $cron->getDayOfWeek());
29
        $this->assertEquals('my_command', $cron->getCommand());
30
        $this->assertEquals(null, $cron->getLogFile());
31
    }
32
}
33