Issues (73)

Tests/RabbitMq/RpcServerTest.php (5 issues)

1
<?php
2
3
namespace OldSound\RabbitMqBundle\Tests\RabbitMq;
4
5
use OldSound\RabbitMqBundle\RabbitMq\RpcServer;
6
use PhpAmqpLib\Message\AMQPMessage;
7
use PHPUnit\Framework\TestCase;
8
9
class RpcServerTest extends TestCase
10
{
11
    public function testProcessMessageWithCustomSerializer()
12
    {
13
        /** @var RpcServer $server */
14
        $server = $this->getMockBuilder('\OldSound\RabbitMqBundle\RabbitMq\RpcServer')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

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

14
        $server = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('\OldSound\RabbitMqBundle\RabbitMq\RpcServer')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
15
            ->setMethods(array('sendReply', 'maybeStopConsumer'))
16
            ->disableOriginalConstructor()
17
            ->getMock();
18
        $message = $this->getMockBuilder('\PhpAmqpLib\Message\AMQPMessage')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

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

18
        $message = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('\PhpAmqpLib\Message\AMQPMessage')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
19
            ->setMethods( array('get'))
20
            ->getMock();
21
        $message->delivery_info = array(
0 ignored issues
show
Accessing delivery_info on the interface PHPUnit\Framework\MockObject\MockObject suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
22
            'channel' => $this->getMockBuilder('\PhpAmqpLib\Channel\AMQPChannel')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

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

22
            'channel' => /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('\PhpAmqpLib\Channel\AMQPChannel')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
23
                ->setMethods(array())->setConstructorArgs(array())
24
                ->setMockClassName('')
25
                ->disableOriginalConstructor()
26
                ->getMock(),
27
            'delivery_tag' => null
28
        );
29
        $server->setCallback(function() {
30
            return 'message';
31
        });
32
        $serializer = $this->getMockBuilder('\Symfony\Component\Serializer\SerializerInterface')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

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

32
        $serializer = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('\Symfony\Component\Serializer\SerializerInterface')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
33
            ->setMethods(array('serialize', 'deserialize'))
34
            ->getMock();
35
        $serializer->expects($this->once())->method('serialize')->with('message', 'json');
36
        $server->setSerializer(function($data) use ($serializer) {
37
            $serializer->serialize($data, 'json');
38
        });
39
        $server->processMessage($message);
40
    }
41
}
42