1 | <?php |
||||||
2 | /** |
||||||
3 | * |
||||||
4 | * This file is part of the Aggrego. |
||||||
5 | * (c) Tomasz Kunicki <[email protected]> |
||||||
6 | * |
||||||
7 | * For the full copyright and license information, please view the LICENSE |
||||||
8 | * file that was distributed with this source code. |
||||||
9 | * |
||||||
10 | */ |
||||||
11 | |||||||
12 | declare(strict_types = 1); |
||||||
13 | |||||||
14 | namespace spec\Aggrego\DomainEventProducer\EventConsumer; |
||||||
15 | |||||||
16 | use Aggrego\DomainEventProducer\Domain\Repository; |
||||||
17 | use Aggrego\DomainEventProducer\EventConsumer\Producer; |
||||||
18 | use Aggrego\EventConsumer\Client; |
||||||
19 | use Aggrego\EventConsumer\Event\CreatedAt; |
||||||
20 | use Aggrego\EventConsumer\Event\Domain; |
||||||
21 | use Aggrego\EventConsumer\Event\Name; |
||||||
22 | use Aggrego\EventConsumer\Event\Version; |
||||||
23 | use Aggrego\EventConsumer\Shared\Event; |
||||||
24 | use Aggrego\EventConsumer\Shared\Events; |
||||||
25 | use DateTimeImmutable; |
||||||
26 | use PhpSpec\ObjectBehavior; |
||||||
27 | use Prophecy\Argument; |
||||||
28 | |||||||
29 | class ProducerSpec extends ObjectBehavior |
||||||
30 | { |
||||||
31 | function let(Repository $repository, Client $client) |
||||||
0 ignored issues
–
show
|
|||||||
32 | { |
||||||
33 | $this->beConstructedWith($repository, $client); |
||||||
34 | } |
||||||
35 | |||||||
36 | function it_is_initializable() |
||||||
0 ignored issues
–
show
|
|||||||
37 | { |
||||||
38 | $this->shouldHaveType(Producer::class); |
||||||
39 | } |
||||||
40 | |||||||
41 | function it_should_publish_events(Repository $repository, Client $client) |
||||||
42 | { |
||||||
43 | $events = new Events(); |
||||||
44 | $events->add( |
||||||
45 | new Event( |
||||||
46 | Domain::fromString('Test:7835a2f1-65c4-4e05-aacf-2e9ed950f5f2'), |
||||||
47 | new Name('test'), |
||||||
48 | new CreatedAt(new DateTimeImmutable()), |
||||||
49 | new Version('1.0.0.0'), |
||||||
50 | [] |
||||||
51 | ) |
||||||
52 | ); |
||||||
53 | $repository->pullEvents()->willReturn($events); |
||||||
0 ignored issues
–
show
The method
willReturn() does not exist on Aggrego\EventConsumer\Shared\Events .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
54 | $client->consume(Argument::type(Event::class))->shouldBeCalled(); |
||||||
0 ignored issues
–
show
Are you sure the usage of
$client->consume(Prophec...r\Shared\Event::class)) targeting Aggrego\EventConsumer\Client::consume() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() Prophecy\Argument::type(...er\Shared\Event::class) of type Prophecy\Argument\Token\TypeToken is incompatible with the type Aggrego\EventConsumer\Event expected by parameter $event of Aggrego\EventConsumer\Client::consume() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
55 | $this->beConstructedWith($repository, $client); |
||||||
56 | |||||||
57 | $this->publish()->shouldReturn(null); |
||||||
0 ignored issues
–
show
The method
publish() does not exist on spec\Aggrego\DomainEvent...ntConsumer\ProducerSpec . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
58 | } |
||||||
59 | } |
||||||
60 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.