NotificationFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 24
rs 10
eloc 7

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreatesTelegramSentryNotification() 0 6 1
A testThrowsExceptionForUnknownService() 0 6 1
1
<?php
2
3
namespace Tests\Unit\Notifications\Factories;
4
5
use Orchestra\Testbench\TestCase;
6
use Skater4\LaravelSentryNotifications\Enum\Services;
7
use Skater4\LaravelSentryNotifications\Notifications\Factories\NotificationFactory;
8
use Skater4\LaravelSentryNotifications\Exceptions\UnknownServiceException;
9
use Skater4\LaravelSentryNotifications\Notifications\Services\Telegram\TelegramSentryNotification;
10
11
class NotificationFactoryTest extends TestCase
12
{
13
    /**
14
     * @return void
15
     * @throws UnknownServiceException
16
     */
17
    public function testCreatesTelegramSentryNotification()
18
    {
19
        $factory = new NotificationFactory(Services::SERVICE_TELEGRAM);
20
        $notification = $factory->create();
21
22
        $this->assertInstanceOf(TelegramSentryNotification::class, $notification);
23
    }
24
25
    /**
26
     * @return void
27
     * @throws UnknownServiceException
28
     */
29
    public function testThrowsExceptionForUnknownService()
30
    {
31
        $this->expectException(UnknownServiceException::class);
32
33
        $factory = new NotificationFactory('wtf?');
34
        $factory->create();
35
    }
36
}
37