|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CronBundle\Tests\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Alpixel\Bundle\CronBundle\Entity\CronJobResult; |
|
6
|
|
|
|
|
7
|
|
|
class CronJobResultTest extends \PHPUnit_Framework_TestCase |
|
8
|
|
|
{ |
|
9
|
|
|
public function testRunAt() |
|
10
|
|
|
{ |
|
11
|
|
|
$result = $this->getCronJobResult(); |
|
12
|
|
|
$this->assertNotNull($result->getRunAt()); |
|
13
|
|
|
|
|
14
|
|
|
$result->setRunAt(new \DateTime('1987-04-16')); |
|
15
|
|
|
$this->assertEquals(new \DateTime('1987-04-16'), $result->getRunAt()); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function testRunTime() |
|
19
|
|
|
{ |
|
20
|
|
|
$result = $this->getCronJobResult(); |
|
21
|
|
|
$this->assertNull($result->getRunTime()); |
|
22
|
|
|
|
|
23
|
|
|
$result->setRunTime(2.54); |
|
24
|
|
|
$this->assertEquals(2.54, $result->getRunTime()); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function testResult() |
|
28
|
|
|
{ |
|
29
|
|
|
$result = $this->getCronJobResult(); |
|
30
|
|
|
$this->assertNull($result->getResult()); |
|
31
|
|
|
|
|
32
|
|
|
$result->setResult(CronJobResult::SUCCEEDED); |
|
33
|
|
|
$this->assertEquals(CronJobResult::SUCCEEDED, $result->getResult()); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testOutput() |
|
37
|
|
|
{ |
|
38
|
|
|
$result = $this->getCronJobResult(); |
|
39
|
|
|
$this->assertNull($result->getOutput()); |
|
40
|
|
|
|
|
41
|
|
|
$result->setOutput('success'); |
|
42
|
|
|
$this->assertEquals('success', $result->getOutput()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testJob() |
|
46
|
|
|
{ |
|
47
|
|
|
$result = $this->getCronJobResult(); |
|
48
|
|
|
$this->assertNull($result->getJob()); |
|
49
|
|
|
|
|
50
|
|
|
$job = $this->getMockForAbstractClass('Alpixel\Bundle\CronBundle\Entity\CronJob'); |
|
51
|
|
|
|
|
52
|
|
|
$result->setJob($job); |
|
53
|
|
|
$this->assertEquals($job, $result->getJob()); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getCronJobResult() |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->getMockForAbstractClass('Alpixel\Bundle\CronBundle\Entity\CronJobResult'); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|