Test Failed
Branch main (1f5430)
by Rizart
01:43
created

ClientTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A it_appends_api_key_as_query_string() 0 9 1
A throws_missing_api_key_exception() 0 5 1
A it_maintains_api_host() 0 9 1
1
<?php
2
3
namespace Tests\Unit;
4
5
use ElasticEmail\Client;
6
use ElasticEmail\ElasticEmailException;
7
8
class ClientTest extends UnitTestCase
9
{
10
    /** @test */
11
    public function it_maintains_api_host()
12
    {
13
        $container = [];
14
15
        $client = $this->mockAPIRequest($container, $key = 'key');
16
17
        $client->request('POST');
18
19
        $this->assertAPIBaseURIEquals($container, 'api.elasticemail.com');
20
    }
21
22
    /** @test */
23
    public function throws_missing_api_key_exception()
24
    {
25
        $this->expectException(ElasticEmailException::class);
26
27
        new Client('');
28
    }
29
30
    /** @test */
31
    public function it_appends_api_key_as_query_string()
32
    {
33
        $container = [];
34
35
        $client = $this->mockAPIRequest($container, $key = 'key');
36
37
        $client->request('POST');
38
39
        $this->assertAPIRequestQueryHas($container, "apikey=$key");
40
    }
41
}
42