Passed
Pull Request — master (#380)
by Wilmer
13:12
created

DefaultValueConstraintTest::testGetValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Constraint;
6
7
use PHPUnit\Framework\TestCase;
8
use stdClass;
9
use Yiisoft\Db\Constraint\DefaultValueConstraint;
10
11
/**
12
 * @group db
13
 */
14
final class DefaultValueConstraintTest extends TestCase
15
{
16
    public function testGetValue(): void
17
    {
18
        $defaultValueConstraint = new DefaultValueConstraint();
19
20
        $this->assertNull($defaultValueConstraint->getValue());
21
22
        $defaultValueConstraint = $defaultValueConstraint->value('value');
23
24
        $this->assertSame('value', $defaultValueConstraint->getValue());
25
26
        $defaultValueConstraint = $defaultValueConstraint->value(new stdClass());
27
28
        $this->assertInstanceOf(stdClass::class, $defaultValueConstraint->getValue());
29
    }
30
}
31