MagicCallPatchTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A it_supports_classes_with_invalid_tags() 0 20 2
1
<?php
2
3
namespace Tests\Prophecy\Doubler\ClassPatch;
4
5
use PHPUnit\Framework\TestCase;
6
use Prophecy\Doubler\ClassPatch\MagicCallPatch;
7
use Prophecy\Doubler\Generator\ClassMirror;
8
9
class MagicCallPatchTest extends TestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function it_supports_classes_with_invalid_tags()
15
    {
16
        $class = new \ReflectionClass('Fixtures\Prophecy\WithPhpdocClass');
17
18
        $mirror = new ClassMirror();
19
        $classNode = $mirror->reflect($class, array());
20
21
        $patch = new MagicCallPatch();
22
23
        $patch->apply($classNode);
24
25
        // Newer phpDocumentor versions allow reading valid method tags, even when some other tags are invalid
26
        // Some older versions might also have this method due to not considering the method tag invalid as rule evolved, but we don't track that.
27
        if (class_exists('phpDocumentor\Reflection\DocBlock\Tags\InvalidTag')) {
28
            $this->assertTrue($classNode->hasMethod('name'));
29
        }
30
31
        // We expect no error when processing the class patch. But we still need to increment the assertion count.
32
        $this->assertTrue(true);
33
    }
34
}
35