Failed Conditions
Pull Request — master (#7842)
by
unknown
12:00
created

SqliteSchemaToolTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Functional\SchemaTool;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\ORM\Annotation as ORM;
9
use Doctrine\ORM\Tools;
10
use Doctrine\Tests\OrmFunctionalTestCase;
11
12
class SqliteSchemaToolTest extends OrmFunctionalTestCase
13
{
14
    public function setUp(): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
15
    {
16
        parent::setUp();
17
18
        $this->schemaTool = new Tools\SchemaTool($this->em);
19
    }
20
21
    public function testForeignKeysIsNotCompared(): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
22
    {
23
        if ($this->em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
24
            $this->markTestSkipped('Test for platforms without foreign keys support');
25
        }
26
        $class = $this->em->getClassMetadata(SqliteSchemaToolChild::class);
27
        $this->schemaTool->updateSchema([$class]);
28
        $diff = $this->schemaTool->getUpdateSchemaSql([$class]);
29
30
        self::assertCount(0, $diff);
31
    }
32
}
33
34
/**
35
 * @ORM\Entity
36
 */
37
class SqliteSchemaToolParent
38
{
39
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
40
    public $id;
41
42
    /** @ORM\OneToMany(targetEntity=SqliteSchemaToolChild::class, mappedBy="parent") */
43
    public $children;
44
45
    public function __construct()
46
    {
47
        $this->children = new ArrayCollection();
48
    }
49
}
50
51
/**
52
 * @ORM\Entity
53
 */
54
class SqliteSchemaToolChild
55
{
56
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
57
    public $id;
58
59
    /** @ORM\ManyToOne(targetEntity=SqliteSchemaToolParent::class) */
60
    public $parent;
61
}
62