PivotTableMethodsDescriptorTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetters() 0 13 1
1
<?php
2
3
namespace TheCodingMachine\TDBM\Utils;
4
5
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
6
use Doctrine\DBAL\Schema\Table;
7
use PHPUnit\Framework\TestCase;
8
use TheCodingMachine\TDBM\Utils\Annotation\AnnotationParser;
9
10
class PivotTableMethodsDescriptorTest extends TestCase
11
{
12
    public function testGetters(): void
13
    {
14
        $table = $this->createMock(Table::class);
15
        $localFk = new ForeignKeyConstraint(['foo'], new Table('table1'), ['lol']);
16
        $localFk->setLocalTable(new Table('table3'));
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Schema\For...traint::setLocalTable() has been deprecated: Use the table that contains the foreign key as part of its {@see Table::$_fkConstraints} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

16
        /** @scrutinizer ignore-deprecated */ $localFk->setLocalTable(new Table('table3'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
17
        $remoteFk = new ForeignKeyConstraint(['foo2'], new Table('table2'), ['lol2']);
18
        $remoteFk->setLocalTable(new Table('table3'));
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Schema\For...traint::setLocalTable() has been deprecated: Use the table that contains the foreign key as part of its {@see Table::$_fkConstraints} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

18
        /** @scrutinizer ignore-deprecated */ $remoteFk->setLocalTable(new Table('table3'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
19
        $ns = $this->createMock(DefaultNamingStrategy::class);
20
        $descriptor = new PivotTableMethodsDescriptor($table, $localFk, $remoteFk, $ns, AnnotationParser::buildWithDefaultAnnotations([]), 'Bean\Namespace', 'ResultIterator\Namespace');
21
22
        $this->assertSame($table, $descriptor->getPivotTable());
23
        $this->assertSame($localFk, $descriptor->getLocalFk());
24
        $this->assertSame($remoteFk, $descriptor->getRemoteFk());
25
    }
26
}
27