Passed
Pull Request — master (#578)
by butschster
07:38
created

NullDriverTest::testJobCallableShouldBePushed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Tests\Queue\Driver;
6
7
use Spiral\Queue\Driver\NullDriver;
8
use Spiral\Tests\Queue\TestCase;
9
10
final class NullDriverTest extends TestCase
11
{
12
    protected function setUp(): void
13
    {
14
        parent::setUp();
15
16
        $this->queue = new NullDriver();
0 ignored issues
show
Bug Best Practice introduced by
The property queue does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
17
    }
18
19
    public function testJobShouldBePushed(): void
20
    {
21
        $id = $this->queue->push('foo', ['foo' => 'bar']);
22
        $this->assertNotNull($id);
23
    }
24
25
    public function testJobObjectShouldBePushed(): void
26
    {
27
        $object = new \stdClass();
28
        $object->foo = 'bar';
29
30
        $id = $this->queue->pushObject($object);
31
        $this->assertNotNull($id);
32
    }
33
34
    public function testJobCallableShouldBePushed(): void
35
    {
36
        $callback = function () {
37
            return 'bar';
38
        };
39
40
        $id = $this->queue->pushCallable($callback);
41
        $this->assertNotNull($id);
42
    }
43
}
44