CommentTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRemoveAnnotation() 0 24 1
A testAddAnnotation() 0 14 1
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