Passed
Pull Request — main (#17)
by Rizart
10:12
created

SendTest::sends_email_with_attachments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.9
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->mockAPIRequest($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 sends_email_with_attachments()
25
    {
26
        $container = [];
27
        $client = $this->mockAPIRequest($container);
28
        $send = new Send($client);
29
30
        $attachmentPaths = [$this->makeAttachment('attachment-content')];
31
        $send->handle(['generic-param' => 'param-contents'], $attachmentPaths);
32
33
        $this->assertAPIRequestHasMultipartField(
34
            ['generic-param' => 'param-contents'],
35
            $container
36
        );
37
        $this->assertAPIRequestHasMultipartFile(
38
            ['lorem.txt' => 'attachment-content'],
39
            $container
40
        );
41
    }
42
}
43