ClientSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\CommandLogicUnit\EventConsumer;
15
16
use Aggrego\CommandConsumer\Client as CommandConsumerClient;
17
use Aggrego\CommandConsumer\Command;
18
use Aggrego\CommandLogicUnit\EventConsumer\Client;
19
use Aggrego\CommandLogicUnit\EventProcessor\EventProcessor;
20
use Aggrego\CommandLogicUnit\Shared\EventProcessor\CommandCollection;
21
use Aggrego\EventConsumer\Shared\Event;
22
use PhpSpec\ObjectBehavior;
23
24
class ClientSpec extends ObjectBehavior
25
{
26
    function let(
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
        EventProcessor $eventProcessor,
28
        CommandConsumerClient $commandConsumerClient
29
    )
30
    {
31
        $this->beConstructedWith($eventProcessor, $commandConsumerClient);
32
    }
33
34
    function it_is_initializable()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
35
    {
36
        $this->shouldHaveType(Client::class);
37
    }
38
39
    function it_should_consume(
40
        EventProcessor $eventProcessor,
41
        CommandConsumerClient $commandConsumerClient,
42
        Command $command,
43
        Event $event
44
    )
45
    {
46
        $eventProcessor->transform($event)->willReturn(new CommandCollection($command->getWrappedObject()));
0 ignored issues
show
Bug introduced by
The method getWrappedObject() does not exist on Aggrego\CommandConsumer\Command. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $eventProcessor->transform($event)->willReturn(new CommandCollection($command->/** @scrutinizer ignore-call */ getWrappedObject()));

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.

Loading history...
Bug introduced by
The method willReturn() does not exist on Aggrego\CommandLogicUnit...essor\CommandCollection. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $eventProcessor->transform($event)->/** @scrutinizer ignore-call */ willReturn(new CommandCollection($command->getWrappedObject()));

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.

Loading history...
47
        $this->beConstructedWith($eventProcessor, $commandConsumerClient);
48
49
        $this->consume($event)->shouldReturn(null);
0 ignored issues
show
Bug introduced by
The method consume() does not exist on spec\Aggrego\CommandLogi...ventConsumer\ClientSpec. 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 ignore-call  annotation

49
        $this->/** @scrutinizer ignore-call */ 
50
               consume($event)->shouldReturn(null);
Loading history...
50
    }
51
}
52