Passed
Pull Request — master (#395)
by Wilmer
04:09 queued 01:23
created

IndexConstraintTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsPrimary() 0 9 1
A testIsUnique() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Constraint;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Constraint\IndexConstraint;
9
10
/**
11
 * @group db
12
 */
13
final class IndexConstraintTest extends TestCase
14
{
15
    public function testIsUnique(): void
16
    {
17
        $indexConstraint = new IndexConstraint();
18
19
        $this->assertFalse($indexConstraint->isUnique());
20
21
        $indexConstraint = $indexConstraint->unique(true);
22
23
        $this->assertTrue($indexConstraint->isUnique());
24
    }
25
26
    public function testIsPrimary(): void
27
    {
28
        $indexConstraint = new IndexConstraint();
29
30
        $this->assertFalse($indexConstraint->isPrimary());
31
32
        $indexConstraint = $indexConstraint->primary(true);
33
34
        $this->assertTrue($indexConstraint->isPrimary());
35
    }
36
}
37