SynchronousTest::testPut()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
rs 10
c 1
b 0
f 1
1
<?php
2
declare(strict_types=1);
3
4
namespace JCIT\jobqueue\tests\unit\components\jobQueues;
5
6
use Codeception\Test\Unit;
7
use JCIT\jobqueue\components\jobQueues\Synchronous;
8
use JCIT\jobqueue\interfaces\JobInterface;
9
use JCIT\jobqueue\jobs\HelloJob;
10
use League\Tactician\CommandBus;
11
12
class SynchronousTest extends Unit
13
{
14
    public function testPut(): void
15
    {
16
        $commandBus = $this->createMock(CommandBus::class);
17
        $counter = 0;
18
        $beforePut = static function (JobInterface $job) use (&$counter) {
0 ignored issues
show
Unused Code introduced by
The parameter $job is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

18
        $beforePut = static function (/** @scrutinizer ignore-unused */ JobInterface $job) use (&$counter) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
            $counter++;
20
        };
21
22
        $jobQueue = new Synchronous($commandBus, $beforePut);
23
        $job = new HelloJob('Test');
24
        $jobQueue->putJob($job);
25
        $this->assertEquals(1, $counter);
26
    }
27
}
28