Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
02:22
created

testValidatesNotNullValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\Annotations\Metadata\Constraint;
6
7
use Doctrine\Annotations\Assembler\Validator\Constraint\Exception\ConstraintNotFulfilled;
8
use Doctrine\Annotations\Assembler\Validator\Constraint\RequiredConstraint;
9
use PHPUnit\Framework\TestCase;
10
11
final class RequiredConstraintTest extends TestCase
12
{
13
    public function testValidatesNotNullValue() : void
14
    {
15
        $constraint = new RequiredConstraint();
16
17
        $constraint->validate('foo');
18
19
        self::assertTrue(true);
20
    }
21
22
    public function testValidatesNullValueAndThrows() : void
23
    {
24
        $constraint = new RequiredConstraint();
25
26
        $this->expectException(ConstraintNotFulfilled::class);
27
28
        $constraint->validate(null);
29
    }
30
}
31