GuzzleClientTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the hogosha-monitor package
5
 *
6
 * Copyright (c) 2016 Guillaume Cavana
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Feel free to edit as you please, and have fun.
12
 *
13
 * @author Guillaume Cavana <[email protected]>
14
 */
15
16
namespace Hogosha\Monitor\Client;
17
18
use GuzzleHttp\Handler\MockHandler;
19
use Webmozart\Console\IO\BufferedIO;
20
21
/**
22
 * @author Guillaume Cavana <[email protected]>
23
 */
24
class GuzzleClientTest extends \PHPUnit_Framework_TestCase
25
{
26
    /**
27
     * @var BufferedIO
28
     */
29
    private $io;
30
31
    protected function setUp()
32
    {
33
        $this->io = new BufferedIO();
34
    }
35
36
    /**
37
     * testClient.
38
     */
39
    public function testClient()
40
    {
41
        $client = GuzzleClient::createClient($this->io);
42
        $this->assertSame(false, $client->getConfig()['allow_redirects']);
43
    }
44
45
    /**
46
     * testClientModifiedOptions.
47
     */
48
    public function testClientModifiedOptions()
49
    {
50
        $client = GuzzleClient::createClient($this->io, ['allow_redirects' => true, 'handler' => new MockHandler()]);
51
        $this->assertSame(true, $client->getConfig()['allow_redirects']);
52
        $this->assertInstanceOf(MockHandler::class, $client->getConfig()['handler']);
53
    }
54
}
55