Failed Conditions
Pull Request — master (#7085)
by Guilherme
14:34
created

Tests/ORM/Functional/Ticket/DDC2182Test.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Functional\Ticket;
6
7
use Doctrine\ORM\Annotation as ORM;
8
use Doctrine\Tests\OrmFunctionalTestCase;
9
10
class DDC2182Test extends OrmFunctionalTestCase
11
{
12
    public function testPassColumnOptionsToJoinColumns()
13
    {
14
        if ($this->em->getConnection()->getDatabasePlatform()->getName() != 'mysql') {
15
            $this->markTestSkipped("This test is useful for all databases, but designed only for mysql.");
16
        }
17
18
        $sql = $this->schemaTool->getCreateSchemaSql(
19
            [
20
            $this->em->getClassMetadata(DDC2182OptionParent::class),
21
            $this->em->getClassMetadata(DDC2182OptionChild::class),
22
            ]
23
        );
24
25
        self::assertEquals("CREATE TABLE DDC2182OptionParent (id INT UNSIGNED NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
26
        self::assertEquals("CREATE TABLE DDC2182OptionChild (id VARCHAR(255) NOT NULL, parent_id INT UNSIGNED DEFAULT NULL, INDEX IDX_B314D4AD727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[1]);
27
        self::assertEquals("ALTER TABLE DDC2182OptionChild ADD CONSTRAINT FK_B314D4AD727ACA70 FOREIGN KEY (parent_id) REFERENCES DDC2182OptionParent (id)", $sql[2]);
28
    }
29
}
30
31
/**
32
 * @ORM\Entity
33
 * @ORM\Table
34
 */
35
class DDC2182OptionParent
36
{
37
    /** @ORM\Id @ORM\Column(type="integer", options={"unsigned": true}) */
38
    private $id;
0 ignored issues
show
The private property $id is not used, and could be removed.
Loading history...
39
}
40
41
/**
42
 * @ORM\Entity
43
 * @ORM\Table
44
 */
45
class DDC2182OptionChild
46
{
47
    /** @ORM\Id @ORM\Column */
48
    private $id;
49
50
    /**
51
     * @ORM\ManyToOne(targetEntity=DDC2182OptionParent::class)
52
     * @ORM\JoinColumn(referencedColumnName="id")
53
     */
54
    private $parent;
0 ignored issues
show
The private property $parent is not used, and could be removed.
Loading history...
55
}
56