MethodFunctionDefinitionChangedTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testWillCheckVisibleMethods() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RoaveTest\BackwardCompatibility\DetectChanges\BCBreak\MethodBased;
6
7
use PHPUnit\Framework\MockObject\MockObject;
8
use PHPUnit\Framework\TestCase;
9
use Roave\BackwardCompatibility\Change;
10
use Roave\BackwardCompatibility\Changes;
11
use Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\FunctionBased;
12
use Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodBased;
13
use Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodFunctionDefinitionChanged;
14
use Roave\BetterReflection\Reflection\ReflectionMethod;
15
use function uniqid;
16
17
/**
18
 * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodFunctionDefinitionChanged
19
 */
20
final class MethodFunctionDefinitionChangedTest extends TestCase
21
{
22
    /** @var FunctionBased&MockObject */
23
    private $functionCheck;
24
25
    /** @var MethodBased */
26
    private $methodCheck;
27
28
    protected function setUp() : void
29
    {
30
        parent::setUp();
31
32
        $this->functionCheck = $this->createMock(FunctionBased::class);
33
        $this->methodCheck   = new MethodFunctionDefinitionChanged($this->functionCheck);
34
    }
35
36
    public function testWillCheckVisibleMethods() : void
37
    {
38
        $from = $this->createMock(ReflectionMethod::class);
39
        $to   = $this->createMock(ReflectionMethod::class);
40
41
        $result = Changes::fromList(Change::changed(uniqid('foo', true), true));
42
43
        $this
44
            ->functionCheck
45
            ->expects(self::any())
46
            ->method('__invoke')
47
            ->with($from, $to)
48
            ->willReturn($result);
49
50
        self::assertEquals($result, $this->methodCheck->__invoke($from, $to));
51
    }
52
}
53