Failed Conditions
Push — travis-php7.4 ( 6887c5 )
by Michael
13:05
created

testMagicSetThrowsBadMethodCallException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\Annotations;
4
5
use Doctrine\Annotations\Annotation;
6
use PHPUnit\Framework\TestCase;
7
8
final class AnnotationTest extends TestCase
9
{
10
    public function testMagicGetThrowsBadMethodCallException()
11
    {
12
        $name = 'foo';
13
14
        $annotation = new Annotation([]);
15
16
        $this->expectException(\BadMethodCallException::class);
17
        $this->expectExceptionMessage(sprintf(
18
            "Unknown property '%s' on annotation '%s'.",
19
            $name,
20
            Annotation::class
21
        ));
22
23
        $annotation->{$name};
24
    }
25
26
    public function testMagicSetThrowsBadMethodCallException()
27
    {
28
        $name = 'foo';
29
30
        $annotation = new Annotation([]);
31
32
        $this->expectException(\BadMethodCallException::class);
33
        $this->expectExceptionMessage(sprintf(
34
            "Unknown property '%s' on annotation '%s'.",
35
            $name,
36
            Annotation::class
37
        ));
38
39
        $annotation->{$name} = 9001;
40
    }
41
}
42