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

JobManagerTest::setUpBeforeClass()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
nc 3
cc 3
eloc 18
nop 0
1
<?php
2
3
namespace Dtc\QueueBundle\Tests\Redis;
4
5
use Dtc\QueueBundle\Model\BaseJob;
6
use Dtc\QueueBundle\Model\Job;
7
use Dtc\QueueBundle\Model\JobTiming;
8
use Dtc\QueueBundle\Manager\JobTimingManager;
9
use Dtc\QueueBundle\Model\RetryableJob;
10
use Dtc\QueueBundle\Model\Run;
11
use Dtc\QueueBundle\Manager\RunManager;
12
use Dtc\QueueBundle\Redis\JobManager;
13
use Dtc\QueueBundle\Redis\Predis;
14
use Dtc\QueueBundle\Tests\FibonacciWorker;
15
use Dtc\QueueBundle\Tests\Manager\AutoRetryTrait;
16
use Dtc\QueueBundle\Tests\Manager\BaseJobManagerTest;
17
use Dtc\QueueBundle\Tests\Manager\PriorityTestTrait;
18
use Dtc\QueueBundle\Tests\Manager\RetryableTrait;
19
use Dtc\QueueBundle\Util\Util;
20
use Predis\Client;
21
22
/**
23
 * @author David
24
 *
25
 * This test requires local beanstalkd running
26
 */
27
class JobManagerTest extends BaseJobManagerTest
28
{
29
    use PriorityTestTrait;
30
    use AutoRetryTrait;
31
    use RetryableTrait;
32
    public static $connection;
33
34
    public static function setUpBeforeClass()
35
    {
36
        if (self::$jobManager) {
37
            parent::setUpBeforeClass();
38
39
            return;
40
        }
41
42
        $host = getenv('REDIS_HOST');
43
        $port = getenv('REDIS_PORT') ?: 6379;
44
        $jobTimingClass = JobTiming::class;
45
        $runClass = Run::class;
46
        $predisClient = new Client(['scheme' => 'tcp', 'host' => $host, 'port' => $port]);
47
        $predisClient->flushall();
48
        $predis = new Predis($predisClient);
49
50
        self::$jobTimingManager = new JobTimingManager($jobTimingClass, false);
51
        self::$runManager = new RunManager($runClass);
52
        self::$jobManager = new JobManager(self::$runManager, self::$jobTimingManager, \Dtc\QueueBundle\Redis\Job::class, 'test_cache_key');
53
        self::$jobManager->setRedis($predis);
54
        self::$jobManager->setMaxPriority(255);
55
        self::$worker = new FibonacciWorker();
56
        parent::setUpBeforeClass();
57
    }
58
59 View Code Duplication
    public function testConstructor()
0 ignored issues
show
Duplication introduced by
This method 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...
60
    {
61
        $test = null;
62
        try {
63
            $test = new JobManager(self::$runManager, self::$jobTimingManager, Job::class, 'something');
64
        } catch (\Exception $exception) {
65
            self::fail("shouldn't get here");
66
        }
67
        self::assertNotNull($test);
68
    }
69
70 View Code Duplication
    public function testGetJobByWorker()
0 ignored issues
show
Duplication introduced by
This method 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...
71
    {
72
        $failed = false;
73
        try {
74
            self::$jobManager->getJob(self::$worker->getName());
75
            $failed = true;
76
        } catch (\Exception $exception) {
77
            self::assertTrue(true);
78
        }
79
        self::assertFalse($failed);
80
    }
81
82 View Code Duplication
    public function testExpiredJob()
0 ignored issues
show
Duplication introduced by
This method 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...
83
    {
84
        $this->drain();
85
        $job = new self::$jobClass(self::$worker, false, null);
86
        $time = time() - 1;
87
        $job->setExpiresAt(new \DateTime("@$time"))->fibonacci(1);
88
        self::assertNotNull($job->getId(), 'Job id should be generated');
89
90
        $jobInQueue = self::$jobManager->getJob();
91
        self::assertNull($jobInQueue, 'The job should have been dropped...');
92
93
        $job = new self::$jobClass(self::$worker, false, null);
94
        $time = time() - 1;
95
        $job->setExpiresAt(new \DateTime("@$time"))->fibonacci(1);
96
97
        $job = new self::$jobClass(self::$worker, false, null);
98
        $time = time() - 1;
99
        $job->setExpiresAt(new \DateTime("@$time"))->fibonacci(5);
100
101
        $job = new self::$jobClass(self::$worker, false, null);
102
        $time = time() - 1;
103
        $job->setExpiresAt(new \DateTime("@$time"))->fibonacci(2);
104
105
        $job = new self::$jobClass(self::$worker, false, null);
106
        $job->fibonacci(1);
107
        $jobInQueue = self::$jobManager->getJob();
108
        self::assertNotNull($jobInQueue, 'There should be a job.');
109
        self::assertEquals(
110
            $job->getId(),
111
            $jobInQueue->getId(),
112
            'Job id returned by manager should be the same'
113
        );
114
    }
115
116
    public function testInvalidReset()
117
    {
118
        $job = new \Dtc\QueueBundle\RabbitMQ\Job();
119
        $failure = false;
120
        try {
121
            self::$jobManager->resetJob($job);
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Dtc\QueueBundle\Manager\JobManagerInterface as the method resetJob() does only exist in the following implementations of said interface: Dtc\QueueBundle\Beanstalkd\JobManager, Dtc\QueueBundle\Doctrine\BaseDoctrineJobManager, Dtc\QueueBundle\Doctrine\DoctrineJobManager, Dtc\QueueBundle\Manager\ArchivableJobManager, Dtc\QueueBundle\Manager\PriorityJobManager, Dtc\QueueBundle\Manager\RetryableJobManager, Dtc\QueueBundle\Manager\StallableJobManager, Dtc\QueueBundle\ODM\JobManager, Dtc\QueueBundle\ORM\JobManager, Dtc\QueueBundle\RabbitMQ\JobManager, Dtc\QueueBundle\Redis\BaseJobManager, Dtc\QueueBundle\Redis\JobManager, Dtc\QueueBundle\Tests\StubJobManager.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
122
            $failure = true;
123
        } catch (\InvalidArgumentException $exception) {
124
            self::assertTrue(true);
125
        }
126
        self::assertFalse($failure);
127
    }
128
129
    public function testBatchJobs()
130
    {
131
        $this->drain();
132
133
        /** @var JobManager|\Dtc\QueueBundle\ORM\JobManager $jobManager */
134
        $worker = self::$worker;
135
        $job1 = $worker->later()->fibonacci(1);
136
        $job2 = $worker->batchLater()->fibonacci(1);
137
138
        self::assertEquals($job1->getId(), $job2->getId());
139
140
        $job = self::$jobManager->getJob();
141
        self::assertEquals($job1->getId(), $job->getId());
142
        self::assertEquals($job1->getPriority(), $job->getPriority());
143
144
        $job = self::$jobManager->getJob();
145
        self::assertNull($job);
146
147
        if (null !== self::$jobManager->getMaxPriority()) {
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Dtc\QueueBundle\Manager\JobManagerInterface as the method getMaxPriority() does only exist in the following implementations of said interface: Dtc\QueueBundle\Doctrine\BaseDoctrineJobManager, Dtc\QueueBundle\Doctrine\DoctrineJobManager, Dtc\QueueBundle\Manager\ArchivableJobManager, Dtc\QueueBundle\Manager\PriorityJobManager, Dtc\QueueBundle\Manager\StallableJobManager, Dtc\QueueBundle\ODM\JobManager, Dtc\QueueBundle\ORM\JobManager, Dtc\QueueBundle\RabbitMQ\JobManager, Dtc\QueueBundle\Redis\BaseJobManager, Dtc\QueueBundle\Redis\JobManager, Dtc\QueueBundle\Tests\StubJobManager.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
148
            $job1 = $worker->later()->fibonacci(1);
149
            $job2 = $worker->batchLater()->setPriority(3)->fibonacci(1);
150
            self::assertEquals($job1->getId(), $job2->getId());
151
            self::assertNotEquals($job1->getPriority(), $job2->getPriority());
152
153
            $job = self::$jobManager->getJob();
154
            self::assertNotNull($job);
155
            self::assertEquals($job1->getId(), $job->getId());
156
            self::assertEquals($job->getPriority(), $job2->getPriority());
157
158
            $job = self::$jobManager->getJob();
159
            self::assertNull($job);
160
        }
161
162
        $job1 = $worker->later(100)->fibonacci(1);
163
        $time1 = new \DateTime('@'.time());
164
        $job2 = $worker->batchLater(0)->fibonacci(1);
165
        $time2 = Util::getDateTimeFromDecimalFormat(Util::getMicrotimeDecimal());
166
167
        self::assertEquals($job1->getId(), $job2->getId());
168
        self::assertGreaterThanOrEqual($time1, $job2->getWhenAt());
169
        self::assertLessThanOrEqual($time2, $job2->getWhenAt());
170
171
        $job = self::$jobManager->getJob();
172
        self::assertNotNull($job);
173
        self::assertEquals($job1->getId(), $job->getId());
174
        if (null !== self::$jobManager->getMaxPriority()) {
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Dtc\QueueBundle\Manager\JobManagerInterface as the method getMaxPriority() does only exist in the following implementations of said interface: Dtc\QueueBundle\Doctrine\BaseDoctrineJobManager, Dtc\QueueBundle\Doctrine\DoctrineJobManager, Dtc\QueueBundle\Manager\ArchivableJobManager, Dtc\QueueBundle\Manager\PriorityJobManager, Dtc\QueueBundle\Manager\StallableJobManager, Dtc\QueueBundle\ODM\JobManager, Dtc\QueueBundle\ORM\JobManager, Dtc\QueueBundle\RabbitMQ\JobManager, Dtc\QueueBundle\Redis\BaseJobManager, Dtc\QueueBundle\Redis\JobManager, Dtc\QueueBundle\Tests\StubJobManager.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
175
            self::assertNotNull($job->getPriority());
176
        } else {
177
            self::assertNull($job->getPriority());
178
        }
179
        self::assertGreaterThanOrEqual($time1, $job->getWhenAt());
180
        self::assertLessThanOrEqual($time2, $job->getWhenAt());
181
182
        if (null !== self::$jobManager->getMaxPriority()) {
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Dtc\QueueBundle\Manager\JobManagerInterface as the method getMaxPriority() does only exist in the following implementations of said interface: Dtc\QueueBundle\Doctrine\BaseDoctrineJobManager, Dtc\QueueBundle\Doctrine\DoctrineJobManager, Dtc\QueueBundle\Manager\ArchivableJobManager, Dtc\QueueBundle\Manager\PriorityJobManager, Dtc\QueueBundle\Manager\StallableJobManager, Dtc\QueueBundle\ODM\JobManager, Dtc\QueueBundle\ORM\JobManager, Dtc\QueueBundle\RabbitMQ\JobManager, Dtc\QueueBundle\Redis\BaseJobManager, Dtc\QueueBundle\Redis\JobManager, Dtc\QueueBundle\Tests\StubJobManager.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
183
            $job1 = $worker->later(100)->setPriority(3)->fibonacci(1);
184
            $priority1 = $job1->getPriority();
185
            $time1 = Util::getDateTimeFromDecimalFormat(Util::getMicrotimeDecimal());
186
            $job2 = $worker->batchLater(0)->setPriority(1)->fibonacci(1);
187
            $time2 = Util::getDateTimeFromDecimalFormat(Util::getMicrotimeDecimal());
188
            self::assertEquals($job1->getId(), $job2->getId());
189
            self::assertNotEquals($priority1, $job2->getPriority());
190
191
            self::assertGreaterThanOrEqual($time1, $job2->getWhenAt());
192
            self::assertLessThanOrEqual($time2, $job2->getWhenAt());
193
        }
194
195
        $this->drain();
196
    }
197
198 View Code Duplication
    public function testSaveJob()
0 ignored issues
show
Duplication introduced by
This method 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...
199
    {
200
        // Make sure a job proper type
201
        $failed = false;
202
        try {
203
            $job = new Job();
204
            self::$jobManager->save($job);
205
            $failed = true;
206
        } catch (\Exception $exception) {
207
            self::assertTrue(true);
208
        }
209
        self::assertFalse($failed);
210
211
        if (null !== self::$jobManager->getMaxPriority()) {
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Dtc\QueueBundle\Manager\JobManagerInterface as the method getMaxPriority() does only exist in the following implementations of said interface: Dtc\QueueBundle\Doctrine\BaseDoctrineJobManager, Dtc\QueueBundle\Doctrine\DoctrineJobManager, Dtc\QueueBundle\Manager\ArchivableJobManager, Dtc\QueueBundle\Manager\PriorityJobManager, Dtc\QueueBundle\Manager\StallableJobManager, Dtc\QueueBundle\ODM\JobManager, Dtc\QueueBundle\ORM\JobManager, Dtc\QueueBundle\RabbitMQ\JobManager, Dtc\QueueBundle\Redis\BaseJobManager, Dtc\QueueBundle\Redis\JobManager, Dtc\QueueBundle\Tests\StubJobManager.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
212
            $job = new self::$jobClass(self::$worker, false, null);
213
            try {
214
                $job->setPriority(256)->fibonacci(1);
215
                $failed = true;
216
            } catch (\Exception $exception) {
217
                self::assertTrue(true);
218
            }
219
            self::assertFalse($failed);
220
221
            $job = new self::$jobClass(self::$worker, false, null);
222
            $job->setPriority(100)->fibonacci(1);
223
            self::assertNotNull($job->getId(), 'Job id should be generated');
224
225
            $jobInQueue = self::$jobManager->getJob();
226
            self::assertNotNull($jobInQueue, 'There should be a job.');
227
            self::$jobManager->saveHistory($jobInQueue);
228
        }
229
230
        $job = new self::$jobClass(self::$worker, false, null);
231
        $job->fibonacci(1);
232
        self::assertNotNull($job->getId(), 'Job id should be generated');
233
234
        $failed = false;
235
        try {
236
            self::$jobManager->getJob('fibonacci');
237
            $failed = true;
238
        } catch (\Exception $exception) {
239
            self::assertTrue(true);
240
        }
241
        self::assertFalse($failed);
242
243
        $failed = false;
244
        try {
245
            self::$jobManager->getJob(null, 'fibonacci');
246
            $failed = true;
247
        } catch (\Exception $exception) {
248
            self::assertTrue(true);
249
        }
250
        self::assertFalse($failed);
251
252
        $jobInQueue = self::$jobManager->getJob();
253
        self::assertNotNull($jobInQueue, 'There should be a job.');
254
        self::assertEquals(
255
            $job->getId(),
256
            $jobInQueue->getId(),
257
            'Job id returned by manager should be the same'
258
        );
259
260
        $job->setStatus(BaseJob::STATUS_SUCCESS);
261
        $badJob = new Job();
262
        $failed = false;
263
        try {
264
            self::$jobManager->saveHistory($badJob);
265
            $failed = true;
266
        } catch (\Exception $exception) {
267
            self::assertTrue(true);
268
        }
269
        self::assertFalse($failed);
270
        self::$jobManager->saveHistory($jobInQueue);
271
    }
272
273
    public function testGetStatus()
274
    {
275
        list(, $status1) = $this->getBaseStatus();
276
        list(, $status2) = $this->getBaseStatus();
277
        $fibonacciStatus1 = $status1['fibonacci->fibonacci()'];
278
        $fibonacciStatus2 = $status2['fibonacci->fibonacci()'];
279
280
        self::assertEquals($fibonacciStatus1[BaseJob::STATUS_NEW] + 1, $fibonacciStatus2[BaseJob::STATUS_NEW]);
281
    }
282
283 View Code Duplication
    protected function getBaseStatus()
0 ignored issues
show
Duplication introduced by
This method 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...
284
    {
285
        /** @var JobManager|\Dtc\QueueBundle\ORM\JobManager $jobManager */
286
        $jobManager = self::$jobManager;
287
        $job = new self::$jobClass(self::$worker, false, null);
288
        $job->fibonacci(1);
289
        $status = $jobManager->getStatus();
290
        self::assertArrayHasKey('fibonacci->fibonacci()', $status);
291
        $fibonacciStatus = $status['fibonacci->fibonacci()'];
292
293
        self::assertArrayHasKey(BaseJob::STATUS_NEW, $fibonacciStatus);
294
        self::assertArrayHasKey(BaseJob::STATUS_EXCEPTION, $fibonacciStatus);
295
        self::assertArrayHasKey(BaseJob::STATUS_RUNNING, $fibonacciStatus);
296
        self::assertArrayHasKey(BaseJob::STATUS_SUCCESS, $fibonacciStatus);
297
        self::assertArrayHasKey(Job::STATUS_EXPIRED, $fibonacciStatus);
298
        self::assertArrayHasKey(RetryableJob::STATUS_MAX_EXCEPTIONS, $fibonacciStatus);
299
        self::assertArrayHasKey(RetryableJob::STATUS_MAX_FAILURES, $fibonacciStatus);
300
        self::assertArrayHasKey(RetryableJob::STATUS_MAX_RETRIES, $fibonacciStatus);
301
302
        return [$job, $status];
303
    }
304
}
305