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

ClientTest::it_appends_api_key_as_query_string()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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