Passed
Push — master ( 0675d7...59fbae )
by Kevin
02:33
created

MessageTaskTest::context_with_no_stamps()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 15
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\Schedule\Task;
4
5
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\Messenger\Envelope;
7
use Symfony\Component\Messenger\Stamp\DelayStamp;
8
use Symfony\Component\Messenger\Stamp\ValidationStamp;
9
use Zenstruck\ScheduleBundle\Schedule\Task\MessageTask;
10
11
/**
12
 * @author Kevin Bond <[email protected]>
13
 */
14
final class MessageTaskTest extends TestCase
15
{
16
    /**
17
     * @test
18
     */
19
    public function object_class_is_set_as_default_description(): void
20
    {
21
        $this->assertSame(self::class, (new MessageTask($this))->getDescription());
22
        $this->assertSame(self::class, (new MessageTask(new Envelope($this)))->getDescription());
23
    }
24
25
    /**
26
     * @test
27
     */
28
    public function context_with_no_stamps(): void
29
    {
30
        $this->assertSame(
31
            [
32
                'Message' => self::class,
33
                'Stamps' => '(none)',
34
            ],
35
            (new MessageTask($this))->getContext()
36
        );
37
        $this->assertSame(
38
            [
39
                'Message' => self::class,
40
                'Stamps' => '(none)',
41
            ],
42
            (new MessageTask(new Envelope($this)))->getContext()
43
        );
44
    }
45
46
    /**
47
     * @test
48
     */
49
    public function context_with_stamps(): void
50
    {
51
        $this->assertSame(
52
            [
53
                'Message' => self::class,
54
                'Stamps' => 'DelayStamp, ValidationStamp',
55
            ],
56
            (new MessageTask($this, [new DelayStamp(4), new ValidationStamp([])]))->getContext()
57
        );
58
        $this->assertSame(
59
            [
60
                'Message' => self::class,
61
                'Stamps' => 'DelayStamp, ValidationStamp',
62
            ],
63
            (new MessageTask(new Envelope($this, [new DelayStamp(4)]), [new ValidationStamp([]), new DelayStamp(4)]))->getContext()
64
        );
65
    }
66
}
67