Passed
Branch master (bab720)
by Rasmus
10:39
created

MailServiceCest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendMail() 0 16 2
1
<?php
2
3
namespace Kodus\Mail\Test\Integration;
4
5
use IntegrationTester;
6
use Kodus\Mail\SMTP\Authenticator\NoAuthenticator;
7
use Kodus\Mail\SMTP\SMTPMailService;
8
use Kodus\Mail\Test\TestMessageFactory;
9
10
class MailServiceCest
11
{
12
    /**
13
     * In this test, we connect using a plain socket without login authentication, then
14
     * attempt to send every kind of test-message implemented by the Test Message Factory.
15
     */
16
    public function sendMail(IntegrationTester $I)
17
    {
18
        $factory = new TestMessageFactory();
19
20
        $client_domain = "localhost";
21
22
        $service = new SMTPMailService(
23
            $I->createSocketConnector(), new NoAuthenticator(), $client_domain
24
        );
25
26
        $messages = $factory->createAllMessageTypes();
27
28
        foreach ($messages as $type => $message) {
29
            $I->amGoingTo("send a message of this type: {$type}");
30
31
            $service->send($message);
32
        }
33
    }
34
}
35