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

ClientTest::it_maintains_api_host()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
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