|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Tests\Manager; |
|
4
|
|
|
|
|
5
|
|
|
use Dtc\QueueBundle\Manager\RetryableJobManager; |
|
6
|
|
|
|
|
7
|
|
|
trait RetryableTrait |
|
8
|
|
|
{ |
|
9
|
|
|
public function testRetryableJobManager() |
|
10
|
|
|
{ |
|
11
|
|
|
/** @var RetryableJobManager $jobManager */ |
|
12
|
|
|
$jobManager = self::$jobManager; |
|
13
|
|
|
$oldMaxExceptions = $jobManager->getDefaultMaxExceptions(); |
|
14
|
|
|
$jobManager->setDefaultMaxExceptions(1234); |
|
15
|
|
|
self::assertEquals(1234, $jobManager->getDefaultMaxExceptions()); |
|
16
|
|
|
$jobManager->setDefaultMaxExceptions($oldMaxExceptions); |
|
17
|
|
|
self::assertEquals($oldMaxExceptions, $jobManager->getDefaultMaxExceptions()); |
|
18
|
|
|
|
|
19
|
|
|
$oldMaxFailures = $jobManager->getDefaultMaxFailures(); |
|
20
|
|
|
$jobManager->setDefaultMaxFailures(3214); |
|
21
|
|
|
self::assertEquals(3214, $jobManager->getDefaultMaxFailures()); |
|
22
|
|
|
$jobManager->setDefaultMaxFailures($oldMaxFailures); |
|
23
|
|
|
self::assertEquals($oldMaxFailures, $jobManager->getDefaultMaxFailures()); |
|
24
|
|
|
|
|
25
|
|
|
$oldMaxRetries = $jobManager->getDefaultMaxRetries(); |
|
26
|
|
|
$jobManager->setDefaultMaxRetries(3214); |
|
27
|
|
|
self::assertEquals(3214, $jobManager->getDefaultMaxRetries()); |
|
28
|
|
|
$jobManager->setDefaultMaxRetries($oldMaxRetries); |
|
29
|
|
|
self::assertEquals($oldMaxRetries, $jobManager->getDefaultMaxRetries()); |
|
30
|
|
|
|
|
31
|
|
|
$oldRetry = $jobManager->getAutoRetryOnException(); |
|
32
|
|
|
$jobManager->setAutoRetryOnException(true); |
|
33
|
|
|
self::assertTrue($jobManager->getAutoRetryOnException()); |
|
34
|
|
|
$jobManager->setAutoRetryOnException(false); |
|
35
|
|
|
self::assertFalse($jobManager->getAutoRetryOnException()); |
|
36
|
|
|
$jobManager->setAutoRetryOnException($oldRetry); |
|
37
|
|
|
|
|
38
|
|
|
$oldRetry = $jobManager->getAutoRetryOnFailure(); |
|
39
|
|
|
$jobManager->setAutoRetryOnFailure(true); |
|
40
|
|
|
self::assertTrue($jobManager->getAutoRetryOnFailure()); |
|
41
|
|
|
$jobManager->setAutoRetryOnFailure(false); |
|
42
|
|
|
self::assertFalse($jobManager->getAutoRetryOnFailure()); |
|
43
|
|
|
$jobManager->setAutoRetryOnFailure($oldRetry); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|