Passed
Push — release/v2 ( 19bb7e...119cbe )
by Benoit
02:55
created

ReaderRegistryTest.php$1 ➔ read()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JBen87\ParsleyBundle\Tests\Constraint\Reader;
4
5
use JBen87\ParsleyBundle\Constraint\Reader\ReaderInterface;
6
use JBen87\ParsleyBundle\Constraint\Reader\ReaderRegistry;
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\Form\FormInterface;
9
10
class ReaderRegistryTest extends TestCase
11
{
12
    public function testAll()
13
    {
14
        $reader1 = new class implements ReaderInterface
15
        {
16
            /**
17
             * @inheritdoc
18
             */
19
            public function read(FormInterface $form): array
20
            {
21
                return [];
22
            }
23
24
            /**
25
             * @inheritdoc
26
             */
27
            public function getPriority(): int
28
            {
29
                return 10;
30
            }
31
        };
32
33
        $reader2 = new class implements ReaderInterface
34
        {
35
            /**
36
             * @inheritdoc
37
             */
38
            public function read(FormInterface $form): array
39
            {
40
                return [];
41
            }
42
43
            /**
44
             * @inheritdoc
45
             */
46
            public function getPriority(): int
47
            {
48
                return 0;
49
            }
50
        };
51
52
        $registry = new ReaderRegistry([$reader1, $reader2]);
53
54
        $this->assertSame([$reader2, $reader1], $registry->all());
55
    }
56
}
57