testThrowsExceptionForUnknownService()   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\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