CommentTest::testAddAnnotation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheCodingMachine\FluidSchema;
4
5
use PHPUnit\Framework\TestCase;
6
7
class CommentTest extends TestCase
8
{
9
10
    public function testRemoveAnnotation()
11
    {
12
        $comment = new Comment(<<<EOF
13
Foo bar
14
15
@Yop
16
@Yop("toto")
17
@Yop ()
18
@Yop     
19
@Foo
20
EOF
21
);
22
        $this->assertTrue($comment->hasAnnotation('Yop'));
23
        $this->assertTrue($comment->hasAnnotation('@Yop'));
24
        $comment->removeAnnotation('Yop');
25
        $this->assertFalse($comment->hasAnnotation('Yop'));
26
        $this->assertFalse($comment->hasAnnotation('@Yop'));
27
        $this->assertSame(<<<EOF
28
Foo bar
29
30
@Foo
31
EOF
32
            , $comment->getComment());
33
    }
34
35
    public function testAddAnnotation()
36
    {
37
        $comment = new Comment(<<<EOF
38
Foo
39
@Yop
40
EOF
41
        );
42
        $comment->addAnnotation('Yop', true);
43
        $this->assertSame(<<<EOF
44
Foo
45
@Yop(true)
46
EOF
47
            , $comment->getComment());
48
    }
49
}
50