SentryNotifierTest::testReportSentryNotification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Unit\Services;
4
5
use Tests\TestCase;
6
use Skater4\LaravelSentryNotifications\Exceptions\SentryNotifierException;
7
use Skater4\LaravelSentryNotifications\Services\SentryNotifier;
8
use Skater4\LaravelSentryNotifications\Services\Sentry\Interfaces\SentryServiceInterface;
9
use Exception;
10
11
class SentryNotifierTest extends TestCase
12
{
13
    /**
14
     * @return void
15
     * @throws SentryNotifierException
16
     */
17
    public function testReportSentryNotification()
18
    {
19
        $sentryServiceMock = $this->createMock(SentryServiceInterface::class);
20
        $sentryServiceMock->method('captureException')
21
            ->willReturn('event_id');
22
        $sentryServiceMock->method('getIssueUrl')
23
            ->with('event_id')
24
            ->willReturn('http://example.com/event');
25
26
        $sentryNotifier = new SentryNotifier($sentryServiceMock);
27
28
        $sentryNotifier->reportSentryNotification(new Exception('Test exception'));
29
        $this->assertTrue(true);
30
    }
31
}
32