Completed
Push — master ( 2308db...df4497 )
by Massimiliano
03:56
created

HttpMockedTestCase::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 1
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Bowerphp\Test;
4
5
use Mockery;
6
7
abstract class HttpMockedTestCase extends BowerphpTestCase
8
{
9
    protected $httpClient;
10
    protected $request;
11
    protected $response;
12
    protected $config;
13
14
    protected function setUp()
15
    {
16
        parent::setUp();
17
        $this->httpClient = Mockery::mock('Github\HttpClient\HttpClientInterface');
18
        $this->response = Mockery::mock('Guzzle\Http\Message\Response');
19
        $this->config = Mockery::mock('Bowerphp\Config\ConfigInterface');
20
21
        $this->config
22
            ->shouldReceive('getOverridesSection')->andReturn([])
23
            ->shouldReceive('getOverrideFor')->andReturn([])
24
            ->shouldReceive('getBasePackagesUrl')->andReturn('http://bower.herokuapp.com/packages/')
25
        ;
26
    }
27
28
    protected function prepareRequest($query, $packageJson)
29
    {
30
        $this->httpClient
31
            ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/' . $query)->andReturn($this->response)
32
        ;
33
        $this->response
34
            ->shouldReceive('getBody')->andReturn($packageJson)
35
        ;
36
    }
37
}
38