Completed
Push — master ( 3853ec...f78c46 )
by Adrien
07:49
created

MappingTest::testMappingIsSync()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\ORM\Query;
6
7
use Doctrine\ORM\Tools\SchemaValidator;
8
use PHPUnit\Framework\TestCase;
9
10
class MappingTest extends TestCase
11
{
12
    public function testMappingIsValid(): void
13
    {
14
        $em = _em();
15
        $validator = new SchemaValidator($em);
16
17
        $result = '';
18
        $errors = $validator->validateMapping();
19
        foreach ($errors as $className => $errorMessages) {
20
            $result .= $className . ':' . PHP_EOL;
21
            foreach ($errorMessages as $e) {
22
                $result .= $e . PHP_EOL;
23
            }
24
            $result .= PHP_EOL;
25
        }
26
27
        self::assertSame('', trim($result), 'should have valid mapping');
28
    }
29
30
    /**
31
     * @runInSeparateProcess
32
     * @preserveGlobalState disabled
33
     */
34
    public function testMappingIsSync(): void
35
    {
36
        $em = _em();
37
        $validator = new SchemaValidator($em);
38
39
        self::assertTrue($validator->schemaInSyncWithMetadata(), 'database should be in sync with mapping');
40
    }
41
}
42