Completed
Push — master ( 7fae80...8ffdf8 )
by Matthew
07:25
created

JobManagerNoPriorityTest::setUpBeforeClass()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 20

Duplication

Lines 24
Ratio 100 %

Importance

Changes 0
Metric Value
dl 24
loc 24
rs 8.9713
c 0
b 0
f 0
nc 2
cc 2
eloc 20
nop 0
1
<?php
2
3
namespace Dtc\QueueBundle\Tests\Redis;
4
5
use Dtc\QueueBundle\Model\JobTiming;
6
use Dtc\QueueBundle\Manager\JobTimingManager;
7
use Dtc\QueueBundle\Model\Run;
8
use Dtc\QueueBundle\Manager\RunManager;
9
use Dtc\QueueBundle\Redis\JobManager;
10
use Dtc\QueueBundle\Redis\PhpRedis;
11
use Dtc\QueueBundle\Tests\FibonacciWorker;
12
use Dtc\QueueBundle\Tests\Manager\AutoRetryTrait;
13
14
/**
15
 * @author David
16
 *
17
 * This test requires local beanstalkd running
18
 */
19 View Code Duplication
class JobManagerNoPriorityTest extends JobManagerTest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    use AutoRetryTrait;
22
    public static $connection;
23
24
    public static function setUpBeforeClass()
25
    {
26
        $host = getenv('REDIS_HOST');
27
        $port = getenv('REDIS_PORT') ?: 6379;
28
        $jobTimingClass = JobTiming::class;
29
        $runClass = Run::class;
30
        $redis = new \Redis();
31
        $redis->connect($host, $port);
32
        $redis->flushAll();
33
        $phpredis = new PhpRedis($redis);
34
35
        self::$jobTimingManager = new JobTimingManager($jobTimingClass, false);
36
        self::$runManager = new RunManager($runClass);
37
        self::$jobManager = new JobManager(
38
            self::$runManager,
39
            self::$jobTimingManager,
40
            \Dtc\QueueBundle\Redis\Job::class,
41
            'test_cache_key'
42
        );
43
        self::$jobManager->setRedis($phpredis);
44
        self::$jobManager->setMaxPriority(null);
45
        self::$worker = new FibonacciWorker();
46
        parent::setUpBeforeClass();
47
    }
48
}
49