Completed
Pull Request — master (#1)
by Victor Hugo
04:00
created

testMissingAPIKeyExceptionIsThrownWhenTheAPIKeyIsEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Deltatuts\Fixer\Test;
4
5
use Deltatuts\Fixer\Exception\MissingAPIKeyException;
6
use Deltatuts\Fixer\FixerHttpClient;
7
use GuzzleHttp\ClientInterface;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class FixerHttpClientTest
12
 * @package Deltatuts\Fixer\Test
13
 */
14
class FixerHttpClientTest extends TestCase
15
{
16
    /**
17
     * @throws MissingAPIKeyException
18
     */
19
    public function testFixerHttpClientIsAValidImplementationOfClientInterface()
20
    {
21
        $client = new FixerHttpClient('some-key');
22
23
        $this->assertInstanceOf(ClientInterface::class, $client);
24
    }
25
26
    /**
27
     * @throws MissingAPIKeyException
28
     */
29
    public function testMissingAPIKeyExceptionIsThrownWhenTheAPIKeyIsEmpty()
30
    {
31
        $this->expectException(MissingAPIKeyException::class);
32
        new FixerHttpClient('');
33
    }
34
35
    /**
36
     * @throws MissingAPIKeyException
37
     */
38
    public function testConfigIsOverwrittenWithCustomConfig()
39
    {
40
        $client = new FixerHttpClient('asdasdad', ['timeout' => 10, 'base_uri' => 'https://victoravelar.com']);
41
        $this->assertArrayHasKey('timeout', $client->getConfig());
42
        $this->assertArrayHasKey('base_uri', $client->getConfig());
43
        $this->assertEquals(10, $client->getConfig('timeout'));
44
        $this->assertEquals('https://victoravelar.com', $client->getConfig('base_uri'));
45
    }
46
}
47