Test Failed
Branch main (0ffd95)
by
unknown
01:57
created

ClientTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A it_maintains_api_baseuri() 0 8 1
A throws_missing_api_key_exception() 0 6 1
A it_appends_api_key_as_query_string() 0 10 1
1
<?php
2
3
namespace Tests\Unit;
4
5
use ElasticEmail\Client;
6
use ElasticEmail\ElasticEmailException;
7
use Tests\TestCase;
8
use TypeError;
9
10
class ClientTest extends UnitTestCase
11
{
12
    /** @test */
13
    public function it_maintains_api_baseuri()
14
    {
15
        $client = new Client('api_key');
16
17
        $actualBaseUri = (string)$client->getConfig('base_uri');
0 ignored issues
show
Deprecated Code introduced by
The method GuzzleHttp\Client::getConfig() has been deprecated with message: Client::getConfig will be removed in guzzlehttp/guzzle:8.0.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
18
19
        $this->assertEquals(Client::$baseUri, $actualBaseUri);
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->mockElasticEmailAPIRequest($container, $key = 'key');
36
37
        $client->request('POST');
38
39
        $this->assertAPIRequestQueryHas($container, "apikey=$key");
40
    }
41
}
42