Failed Conditions
Push — master ( 5e6761...398dce )
by Adrien
04:14 queued 01:57
created

MappingTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 30
rs 10
ccs 0
cts 20
cp 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMappingIsValid() 0 16 3
A testMappingIsSync() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Testing\ORM;
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