jwage /
usage-finder
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | declare(strict_types=1); |
||||||
| 4 | |||||||
| 5 | namespace UsageFinder\Tests; |
||||||
| 6 | |||||||
| 7 | use InvalidArgumentException; |
||||||
| 8 | use UsageFinder\ClassMethodReference; |
||||||
| 9 | |||||||
| 10 | final class ClassMethodReferenceTest extends TestCase |
||||||
| 11 | { |
||||||
| 12 | public function testGetName() : void |
||||||
| 13 | { |
||||||
| 14 | self::assertSame( |
||||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||||
| 15 | 'Doctrine\Common\Collections\Collection::slice', |
||||||
|
0 ignored issues
–
show
'Doctrine\Common\Collections\Collection::slice' of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 16 | (new ClassMethodReference('Doctrine\Common\Collections\Collection::slice'))->getName() |
||||||
| 17 | ); |
||||||
| 18 | } |
||||||
| 19 | |||||||
| 20 | public function testGetClassName() : void |
||||||
| 21 | { |
||||||
| 22 | self::assertSame( |
||||||
|
0 ignored issues
–
show
The method
PHPUnit\Framework\Assert::assertSame() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 23 | 'Doctrine\Common\Collections\Collection', |
||||||
|
0 ignored issues
–
show
'Doctrine\Common\Collections\Collection' of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 24 | (new ClassMethodReference('Doctrine\Common\Collections\Collection::slice'))->getClassName() |
||||||
| 25 | ); |
||||||
| 26 | } |
||||||
| 27 | |||||||
| 28 | public function testGetMethodName() : void |
||||||
| 29 | { |
||||||
| 30 | self::assertSame( |
||||||
|
0 ignored issues
–
show
The method
PHPUnit\Framework\Assert::assertSame() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 31 | 'slice', |
||||||
|
0 ignored issues
–
show
'slice' of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 32 | (new ClassMethodReference('Doctrine\Common\Collections\Collection::slice'))->getMethodName() |
||||||
| 33 | ); |
||||||
| 34 | } |
||||||
| 35 | |||||||
| 36 | /** |
||||||
| 37 | * @dataProvider provideForTestInvalidClassMethodReference |
||||||
| 38 | */ |
||||||
| 39 | public function testInvalidClassMethodReference(string $input, string $message) : void |
||||||
| 40 | { |
||||||
| 41 | self::expectException(InvalidArgumentException::class); |
||||||
|
0 ignored issues
–
show
The method
PHPUnit\Framework\TestCase::expectException() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 42 | self::expectExceptionMessage($message); |
||||||
| 43 | |||||||
| 44 | new ClassMethodReference($input); |
||||||
| 45 | } |
||||||
| 46 | |||||||
| 47 | /** |
||||||
| 48 | * @return array<int, array<int, string>> |
||||||
| 49 | */ |
||||||
| 50 | public function provideForTestInvalidClassMethodReference() : array |
||||||
| 51 | { |
||||||
| 52 | return [ |
||||||
| 53 | [ |
||||||
| 54 | '', |
||||||
| 55 | 'Invalid ClassMethodReference, empty string given. Format must be ClassName::methodName.', |
||||||
| 56 | ], |
||||||
| 57 | [ |
||||||
| 58 | 'Doctrine\Common\Collections\Collection::', |
||||||
| 59 | 'You must specify a method name to find. "Doctrine\Common\Collections\Collection::" given.', |
||||||
| 60 | ], |
||||||
| 61 | [ |
||||||
| 62 | 'Doctrine\Common\Collections\Collection:: ', |
||||||
| 63 | 'You must specify a method name to find. "Doctrine\Common\Collections\Collection:: " given.', |
||||||
| 64 | ], |
||||||
| 65 | [ |
||||||
| 66 | 'Doctrine\Common\Collections\Collection', |
||||||
| 67 | 'Invalid ClassMethodReference, "Doctrine\Common\Collections\Collection" given. Format must be ClassName::methodName.', |
||||||
| 68 | ], |
||||||
| 69 | ]; |
||||||
| 70 | } |
||||||
| 71 | } |
||||||
| 72 |