Passed
Pull Request — master (#372)
by Wilmer
03:26
created

AbstractConstraintTest::testGetSchemaPrimaryKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Constraint\Constraint;
9
10
abstract class AbstractConstraintTest extends TestCase
11
{
12
    public function testGetSchemaPrimaryKeys(): void
13
    {
14
        $db = $this->getConnection();
0 ignored issues
show
Bug introduced by
The method getConnection() does not exist on Yiisoft\Db\Tests\AbstractConstraintTest. ( Ignorable by Annotation )

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

14
        /** @scrutinizer ignore-call */ 
15
        $db = $this->getConnection();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
16
        $tablePks = $db->getSchema()->getSchemaPrimaryKeys();
17
18
        $this->assertIsArray($tablePks);
19
        $this->assertContainsOnlyInstancesOf(Constraint::class, $tablePks);
20
    }
21
22
    public function testGetSchemaUniques(): void
23
    {
24
        $db = $this->getConnection();
25
26
        $tableUniques = $db->getSchema()->getSchemaUniques();
27
28
        $this->assertIsArray($tableUniques);
29
30
        foreach ($tableUniques as $uniques) {
31
            $this->assertIsArray($uniques);
32
            $this->assertContainsOnlyInstancesOf(Constraint::class, $uniques);
33
        }
34
    }
35
}
36