Failed Conditions
Pull Request — master (#7842)
by
unknown
08:56
created

SqliteSchemaToolParent   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
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\EntityManagerInterface;
10
use Doctrine\ORM\Tools\SchemaTool;
11
use Doctrine\Tests\OrmTestCase;
12
use Doctrine\Tests\TestUtil;
13
14
class SqliteSchemaToolTest extends OrmTestCase
15
{
16
    /** @var EntityManagerInterface */
17
    private $em;
18
    /** @var SchemaTool */
19
    private $schemaTool;
20
21
    protected function setUp()
22
    {
23
        parent::setUp();
24
        $this->em = $this->getTestEntityManager(TestUtil::getConnection());
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
25
        $this->schemaTool = new SchemaTool($this->em);
26
    }
27
28
    public function testForeignKeysNotCompare(): void
0 ignored issues
show
introduced by
There must be exactly 1 whitespace between closing parenthesis and return type colon.
Loading history...
29
    {
30
        if ($this->em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
31
            $this->markTestSkipped('Test for platforms without foreign keys support');
32
        }
33
        $class = $this->em->getClassMetadata(SqliteSchemaToolChild::class);
34
        $this->schemaTool->updateSchema([$class]);
35
        $diff = $this->schemaTool->getUpdateSchemaSql([$class]);
36
37
        self::assertEmpty($diff);
38
    }
39
}
40
41
/**
42
 * @ORM\Entity
43
 */
44
class SqliteSchemaToolParent
45
{
46
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
47
    public $id;
48
49
    /** @ORM\OneToMany(targetEntity=SqliteSchemaToolChild::class, mappedBy="parent") */
50
    public $children;
51
52
    public function __construct()
53
    {
54
        $this->children = new ArrayCollection();
55
    }
56
}
57
58
/**
59
 * @ORM\Entity
60
 */
61
class SqliteSchemaToolChild
62
{
63
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
64
    public $id;
65
66
    /** @ORM\ManyToOne(targetEntity=SqliteSchemaToolParent::class) */
67
    public $parent;
68
}
69