Passed
Pull Request — 2.6 (#7684)
by Robert den
07:49
created

GH7684   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 2
b 0
f 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIssue() 0 20 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Functional\Ticket;
6
7
use Doctrine\DBAL\Schema\Table;
8
use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase;
9
10
/**
11
 * Verifies that associations/columns with an inline '_id' get named properly
12
 *
13
 * Github issue: 7684
14
 */
15
class GH7684 extends DatabaseDriverTestCase
16
{
17
    public function testIssue() : void
18
    {
19
        if (! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
20
            $this->markTestSkipped('Platform does not support foreign keys.');
21
        }
22
23
        $table1 = new Table('GH7684_identity_test_table');
24
        $table1->addColumn('id', 'integer');
25
        $table1->setPrimaryKey(['id']);
26
27
        $table2 = new Table('GH7684_identity_test_assoc_table');
28
        $table2->addColumn('id', 'integer');
29
        $table2->addColumn('gh7684_identity_test_id', 'integer');
30
        $table2->setPrimaryKey(['id']);
31
        $table2->addForeignKeyConstraint('GH7684_identity_test', ['gh7684_identity_test_id'], ['id']);
32
33
        $metadatas = $this->convertToClassMetadata([$table1, $table2]);
34
        $metadata  = $metadatas['Gh7684IdentityTestAssocTable'];
35
36
        $this->assertArrayHasKey('gh7684IdentityTest', $metadata->associationMappings);
37
    }
38
}
39