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

SendTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forwards_params_as_http_body() 0 11 1
A use_multipart_option_to_send_files() 0 13 1
1
<?php
2
3
namespace Tests\Unit\Email;
4
5
use ElasticEmail\Email\Send;
6
use Tests\Unit\UnitTestCase;
7
8
class SendTest extends UnitTestCase
9
{
10
    /** @test */
11
    public function forwards_params_as_http_body()
12
    {
13
        $container = [];
14
        $client = $this->mockElasticEmailAPIRequest($container);
15
        $send = new Send($client);
16
17
        $params = ['any-parameter' => 'any-parameter-value'];
18
        $send->handle($params);
19
20
        $this->assertAPIRequestBodyHas($params, $container);
21
    }
22
23
    /** @test */
24
    public function use_multipart_option_to_send_files()
25
    {
26
        $container = [];
27
        $client = $this->mockElasticEmailAPIRequest($container);
28
        $send = new Send($client);
29
30
        $params = [$name = 'any-parameter' => $content = 'file-content'];
31
        $expected = ['name' => $name, 'contents' => $content];
32
33
        $send->handle($params, true);
34
35
        $this->assertAPIRequestMultipartHas($expected, $container);
36
    }
37
38
}
39