SentryIntegrationTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
dl 0
loc 16
rs 10
eloc 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExceptionIsReportedToSentry() 0 14 3
1
<?php
2
3
namespace Tests\Feature\Sentry;
4
5
use Orchestra\Testbench\TestCase;
6
use Exception;
7
use Skater4\LaravelSentryNotifications\Services\Sentry\SentryService;
8
9
class SentryIntegrationTest extends TestCase
10
{
11
    public function testExceptionIsReportedToSentry()
12
    {
13
        $this->mock(SentryService::class, function ($mock) {
14
            $mock->shouldReceive('captureException')
15
                ->once()
16
                ->withArgs(function ($exception) {
17
                    return $exception instanceof Exception && $exception->getMessage() === 'Test exception';
18
                });
19
        });
20
21
        try {
22
            throw new Exception('Test exception');
23
        } catch (Exception $e) {
24
            app(SentryService::class)->captureException($e);
25
        }
26
    }
27
}
28