Passed
Pull Request — 1.x (#6)
by Kevin
06:51
created

TestEnvelope::__call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Zenstruck\Messenger\Test;
4
5
use PHPUnit\Framework\Assert as PHPUnit;
6
use Symfony\Component\Messenger\Envelope;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 *
11
 * @mixin Envelope
12
 */
13
final class TestEnvelope
14
{
15
    private Envelope $envelope;
16
17
    public function __construct(Envelope $envelope)
18
    {
19
        $this->envelope = $envelope;
20
    }
21
22
    public function __call($name, $arguments)
23
    {
24
        return $this->envelope->{$name}(...$arguments);
25
    }
26
27
    public function assertHasStamp(string $class): self
28
    {
29
        PHPUnit::assertNotEmpty($this->envelope->all($class));
30
31
        return $this;
32
    }
33
34
    public function assertNotHasStamp(string $class): self
35
    {
36
        PHPUnit::assertEmpty($this->envelope->all($class));
37
38
        return $this;
39
    }
40
}
41