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

RequiredConstraintTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testValidatesNotNullValue() 0 7 1
A testValidatesNullValueAndThrows() 0 7 1
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