|
3 | 3 | namespace Markup\Bundle\JobQueueBundle\Tests\Service;
|
4 | 4 |
|
5 | 5 | use Doctrine\Common\Persistence\ManagerRegistry;
|
| 6 | +use Markup\JobQueueBundle\Entity\ScheduledJob; |
| 7 | +use Markup\JobQueueBundle\Job\ConsoleCommandJob; |
6 | 8 | use Markup\JobQueueBundle\Job\SleepJob;
|
7 | 9 | use Markup\JobQueueBundle\Model\Job;
|
8 | 10 | use Markup\JobQueueBundle\Publisher\JobPublisher;
|
@@ -40,23 +42,28 @@ protected function setUp()
|
40 | 42 | );
|
41 | 43 | }
|
42 | 44 |
|
43 |
| - public function testCanAddJob() |
| 45 | + public function testCanAddJobWithoutDateTime(): void |
44 | 46 | {
|
45 | 47 | $job = new SleepJob();
|
46 |
| - $scheduledTime = new \DateTime(); |
47 | 48 | $this->jobManager->addJob($job);
|
48 |
| - $this->jobManager->addJob($job, $scheduledTime); |
49 | 49 | $this->assertSame([$job], $this->jobPublisher->getJobs());
|
| 50 | + } |
| 51 | + |
| 52 | + public function testCanAddConsoleCommandJobWithDateTime(): void |
| 53 | + { |
| 54 | + $job = new ConsoleCommandJob(); |
| 55 | + $scheduledTime = new \DateTime(); |
| 56 | + $this->jobManager->addJob($job, $scheduledTime); |
50 | 57 | $this->assertSame([$job], $this->scheduledJobService->getJobs());
|
51 | 58 | }
|
52 | 59 |
|
53 |
| - public function testCanAddCommandJob() |
| 60 | + public function testCanAddCommandJob(): void |
54 | 61 | {
|
55 | 62 | $this->jobManager->addCommandJob('console:herp:derp', 'system', 60, 60);
|
56 | 63 | $this->assertCount(1, $this->jobPublisher->getJobs());
|
57 | 64 | }
|
58 | 65 |
|
59 |
| - public function testIdleTimeoutDefaultsToTimeout() |
| 66 | + public function testIdleTimeoutDefaultsToTimeout(): void |
60 | 67 | {
|
61 | 68 | $timeout = 720;
|
62 | 69 | $this->jobManager->addCommandJob('command', 'topic', $timeout);
|
@@ -94,7 +101,7 @@ public function __construct()
|
94 | 101 | $this->initializeJobs();
|
95 | 102 | }
|
96 | 103 |
|
97 |
| - public function addScheduledJob(Job $job, $scheduledTime) |
| 104 | + public function addScheduledJob(ConsoleCommandJob $job, $scheduledTime) |
98 | 105 | {
|
99 | 106 | $this->addJob($job);
|
100 | 107 | }
|
|
0 commit comments