FilterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFilterWithNullObject() 0 4 1
A setUp() 0 7 1
A testWrapper() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Bukashk0zzz\FilterBundle\Tests\Service;
4
5
use Bukashk0zzz\FilterBundle\Service\Filter;
6
use Doctrine\Common\Annotations\AnnotationReader;
7
use Doctrine\Common\Annotations\CachedReader;
8
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
9
use PHPUnit\Framework\TestCase;
10
use Symfony\Component\Cache\Adapter\ArrayAdapter;
11
12
/**
13
 * Test the FilterTest.
14
 *
15
 * @internal
16
 */
17
final class FilterTest extends TestCase
18
{
19
    /**
20
     * @var Filter
21
     */
22
    protected $filter;
23
24
    /**
25
     * Setup.
26
     */
27
    protected function setUp(): void
28
    {
29
        $cache = DoctrineProvider::wrap(
30
            new ArrayAdapter()
31
        );
32
33
        $this->filter = new Filter(new CachedReader(new AnnotationReader(), $cache));
0 ignored issues
show
Deprecated Code introduced by
The class Doctrine\Common\Annotations\CachedReader has been deprecated: the CachedReader is deprecated and will be removed in version 2.0.0 of doctrine/annotations. Please use the {@see \Doctrine\Common\Annotations\PsrCachedReader} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

33
        $this->filter = new Filter(/** @scrutinizer ignore-deprecated */ new CachedReader(new AnnotationReader(), $cache));
Loading history...
34
    }
35
36
    /**
37
     * Service init test.
38
     */
39
    public function testWrapper(): void
40
    {
41
        // check if instance
42
        static::assertInstanceOf(Filter::class, $this->filter);
43
    }
44
45
    /**
46
     * Test Filter With Object that null.
47
     */
48
    public function testFilterWithNullObject(): void
49
    {
50
        $this->filter->filterEntity(null);
51
        static::assertTrue(true);
52
    }
53
}
54