InProcessTransportTest::testSend()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/message-bus project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Tests\MessageBus\Channel\Subscription;
10
11
use Daikon\MessageBus\Channel\Subscription\Transport\InProcessTransport;
12
use Daikon\MessageBus\Envelope;
13
use Daikon\MessageBus\MessageBusInterface;
14
use Daikon\MessageBus\MessageInterface;
15
use Daikon\Metadata\Metadata;
16
use PHPUnit\Framework\TestCase;
17
18
final class InProcessTransportTest extends TestCase
19
{
20 1
    public function testGetKey(): void
21
    {
22 1
        $this->assertEquals((new InProcessTransport('inproc'))->getKey(), 'inproc');
23 1
    }
24
25 1
    public function testSend(): void
26
    {
27
        /** @var MessageInterface $messageMock */
28 1
        $messageMock = $this->createMock(MessageInterface::class);
29 1
        $envelopeExpectation = Envelope::wrap($messageMock, Metadata::makeEmpty());
30 1
        $transport = new InProcessTransport('inproc');
31 1
        $messageBusMock = $this->createMock(MessageBusInterface::class);
32 1
        $messageBusMock->expects($this->once())->method('receive')->with($envelopeExpectation);
33
        /** @var MessageBusInterface $messageBusMock */
34 1
        $this->assertNull($transport->send($envelopeExpectation, $messageBusMock));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $transport->send($envelo...ation, $messageBusMock) targeting Daikon\MessageBus\Channe...rocessTransport::send() 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 getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
35 1
    }
36
}
37