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

SendTest::send_an_email()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Integration\Email;
4
5
use ElasticEmail\ElasticEmail;
6
use Tests\Integration\IntegrationTestCase;
7
8
class SendTest extends IntegrationTestCase
9
{
10
    /** @test */
11
    public function send_an_email()
12
    {
13
        $this->loadEnv();
14
        $subject = "elasticemail-php: Integration test ensuring email send.";
15
16
        $elasticEmail = new ElasticEmail($_ENV['ELASTIC_EMAIL_API_KEY']);
17
        $response = $elasticEmail->email()->send([
18
            'to' => $_ENV['TEST_EMAIL_TO'],
19
            'from' => $_ENV['TEST_EMAIL_FROM'],
20
            'subject' => $subject,
21
            'bodyText' => 'Your mind will answer most questions if you learn '
22
                . 'to relax and wait for the answer.'
23
        ]);
24
25
        $this->assertTrue($response->wasSuccessful());
26
        $this->assertEquals(200, $response->getStatusCode());
27
28
        d($response->getBody());
29
    }
30
}
31