|
@@ 25-45 (lines=21) @@
|
| 22 |
|
$this->elementSorter = new ElementSorter; |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
public function testSortElementsByFqnConstants(): void |
| 26 |
|
{ |
| 27 |
|
$constantReflectionMock = $this->createMock(ConstantReflectionInterface::class); |
| 28 |
|
$constantReflectionMock->method('getDeclaringClassName') |
| 29 |
|
->willReturn('B'); |
| 30 |
|
$constantReflectionMock->method('getName') |
| 31 |
|
->willReturn('C'); |
| 32 |
|
|
| 33 |
|
$constantReflectionMock2 = $this->createMock(ConstantReflectionInterface::class); |
| 34 |
|
$constantReflectionMock2->method('getDeclaringClassName') |
| 35 |
|
->willReturn('A'); |
| 36 |
|
$constantReflectionMock2->method('getName') |
| 37 |
|
->willReturn('D'); |
| 38 |
|
|
| 39 |
|
$elements = [$constantReflectionMock, $constantReflectionMock2]; |
| 40 |
|
|
| 41 |
|
$sortedElements = $this->elementSorter->sortElementsByFqn($elements); |
| 42 |
|
$this->assertNotSame($elements, $sortedElements); |
| 43 |
|
$this->assertSame($constantReflectionMock2, $sortedElements[0]); |
| 44 |
|
$this->assertSame($constantReflectionMock, $sortedElements[1]); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testSortElementsByFqnFunctions(): void |
| 48 |
|
{ |
|
@@ 47-67 (lines=21) @@
|
| 44 |
|
$this->assertSame($constantReflectionMock, $sortedElements[1]); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testSortElementsByFqnFunctions(): void |
| 48 |
|
{ |
| 49 |
|
$reflectionFunctionMock = $this->createMock(FunctionReflectionInterface::class); |
| 50 |
|
$reflectionFunctionMock->method('getNamespaceName') |
| 51 |
|
->willReturn('B'); |
| 52 |
|
$reflectionFunctionMock->method('getName') |
| 53 |
|
->willReturn('C'); |
| 54 |
|
|
| 55 |
|
$reflectionFunctionMock2 = $this->createMock(FunctionReflectionInterface::class); |
| 56 |
|
$reflectionFunctionMock2->method('getNamespaceName') |
| 57 |
|
->willReturn('A'); |
| 58 |
|
$reflectionFunctionMock2->method('getName') |
| 59 |
|
->willReturn('D'); |
| 60 |
|
|
| 61 |
|
$elements = [$reflectionFunctionMock, $reflectionFunctionMock2]; |
| 62 |
|
|
| 63 |
|
$sortedElements = $this->elementSorter->sortElementsByFqn($elements); |
| 64 |
|
$this->assertNotSame($elements, $sortedElements); |
| 65 |
|
$this->assertSame($reflectionFunctionMock2, $sortedElements[0]); |
| 66 |
|
$this->assertSame($reflectionFunctionMock, $sortedElements[1]); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
public function testSortElementsByFqnMethod(): void |
| 70 |
|
{ |