Completed
Pull Request — 3.x (#336)
by
unknown
02:15
created

RabbitMQQueueStatusHttpProviderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 17 1
A testGetApiQueueStatus() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\NotificationBundle\Service;
13
14
use Http\Message\MessageFactory;
15
use Http\Mock\Client;
16
use Psr\Http\Message\RequestInterface;
17
use Psr\Http\Message\ResponseInterface;
18
19
class RabbitMQQueueStatusHttpProviderTest extends AbstractRabbitMQQueueStatusProviderTest
20
{
21
    /** @var Client */
22
    protected $client;
23
24
    /** @var MessageFactory */
25
    protected $messageFactory;
26
27
    public function setUp()
28
    {
29
        parent::setUp();
30
31
        $mockRequest = $this->createMock(RequestInterface::class);
32
        $mockRequest->expects($this->once())->method('withHeader')->will($this->returnValue($mockRequest));
33
34
        $this->messageFactory = $this->createMock(MessageFactory::class);
35
        $this->messageFactory->expects($this->once())->method('createRequest')->will($this->returnValue($mockRequest));
36
37
        $mockResponse = $this->createMock(ResponseInterface::class);
38
        $mockResponse->expects($this->once())->method('getStatusCode')->will($this->returnValue(200));
39
        $mockResponse->expects($this->once())->method('getBody')->will($this->returnValue(json_encode([])));
40
41
        $this->client = $this->createMock(Client::class);
42
        $this->client->expects($this->once())->method('sendRequest')->will($this->returnValue($mockResponse));
43
    }
44
45
    public function testGetApiQueueStatus()
46
    {
47
        $provider = new RabbitMQQueueStatusHttpProvider($this->settings, $this->client, $this->messageFactory);
48
49
        $this->assertEquals([], $provider->getApiQueueStatus());
50
    }
51
}
52