Passed
Push — master ( 89f24e...8c4dad )
by Sylvain
08:05
created

NoMailTest::testFilter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix\Log\Filter;
6
7
use Ecodev\Felix\Api\ExceptionWithoutMailLogging;
8
use Ecodev\Felix\Log\Filter\NoMail;
9
use Exception;
10
use GraphQL\Error\Error;
11
use PHPUnit\Framework\TestCase;
12
13
class NoMailTest extends TestCase
14
{
15
    /**
16
     * @dataProvider providerFilter
17
     */
18
    public function testFilter(array $event, bool $expected): void
19
    {
20
        $filter = new NoMail();
21
        $actual = $filter->filter($event);
22
        self::assertSame($expected, $actual);
23
    }
24
25
    public function providerFilter(): array
26
    {
27
        return [
28
            [[], true],
29
            [['extra' => []], true],
30
            [['extra' => ['exception' => null]], true],
31
            [['extra' => ['exception' => []]], true],
32
            [['extra' => ['exception' => new Exception()]], true],
33
            [['extra' => ['exception' => new Exception('', 0, new Exception())]], true],
34
            [['extra' => ['exception' => new Exception('', 0, new ExceptionWithoutMailLogging())]], true],
35
            [['extra' => ['exception' => new ExceptionWithoutMailLogging()]], false],
36
            [['extra' => ['exception' => new Error()]], true],
37
            [['extra' => ['exception' => new Error('', null, null, [], null, new Exception())]], true],
38
            [['extra' => ['exception' => new Error('', null, null, [], null, new ExceptionWithoutMailLogging())]], false],
39
        ];
40
    }
41
}
42