testCreatesTelegramMessageFormatter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 10
eloc 3
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Unit\Services\Messengers\Factories;
4
5
use PHPUnit\Framework\TestCase;
6
use Skater4\LaravelSentryNotifications\Enum\Services;
7
use Skater4\LaravelSentryNotifications\Exceptions\UnknownServiceException;
8
use Skater4\LaravelSentryNotifications\Services\Messengers\Clients\Telegram\TelegramMessageFormatter;
9
use Skater4\LaravelSentryNotifications\Services\Messengers\Factories\MessageFormatterFactory;
10
11
class MessageFormatterFactoryTest extends TestCase
12
{
13
    /**
14
     * @return void
15
     * @throws UnknownServiceException
16
     */
17
    public function testCreatesTelegramMessageFormatter()
18
    {
19
        $factory = new MessageFormatterFactory(Services::SERVICE_TELEGRAM);
20
        $formatter = $factory->create();
21
22
        $this->assertInstanceOf(TelegramMessageFormatter::class, $formatter);
23
    }
24
25
    /**
26
     * @return void
27
     * @throws UnknownServiceException
28
     */
29
    public function testThrowsExceptionForUnknownService()
30
    {
31
        $this->expectException(UnknownServiceException::class);
32
33
        $factory = new MessageFormatterFactory('wtf?');
34
        $factory->create();
35
    }
36
}
37