CronTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testAdd() 0 6 1
A testParseValidCron() 0 11 1
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