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

NullDriverTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testJobObjectShouldBePushed() 0 7 1
A testJobShouldBePushed() 0 4 1
A testJobCallableShouldBePushed() 0 8 1
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