|
3 | 3 | namespace PHPStan\Reflection\Dibi;
|
4 | 4 |
|
5 | 5 | use PHPStan\Reflection\ClassReflection;
|
| 6 | +use PHPStan\Type\ObjectType; |
6 | 7 |
|
7 | 8 | class DibiFluentClassReflectionExtensionTest extends \PHPUnit_Framework_TestCase
|
8 | 9 | {
|
@@ -41,4 +42,21 @@ public function testHasMethod(string $className, bool $result)
|
41 | 42 | $this->assertSame($result, $this->extension->hasMethod($classReflection, 'select'));
|
42 | 43 | }
|
43 | 44 |
|
| 45 | + public function testGetMethod() |
| 46 | + { |
| 47 | + $classReflection = $this->createMock(ClassReflection::class); |
| 48 | + $classReflection->method('getName')->will($this->returnValue(\Dibi\Fluent::class)); |
| 49 | + $methodReflection = $this->extension->getMethod($classReflection, 'select'); |
| 50 | + $this->assertSame('select', $methodReflection->getName()); |
| 51 | + $this->assertSame($classReflection, $methodReflection->getDeclaringClass()); |
| 52 | + $this->assertFalse($methodReflection->isStatic()); |
| 53 | + $this->assertEmpty($methodReflection->getParameters()); |
| 54 | + $this->assertTrue($methodReflection->isVariadic()); |
| 55 | + $this->assertFalse($methodReflection->isPrivate()); |
| 56 | + $this->assertTrue($methodReflection->isPublic()); |
| 57 | + $this->assertInstanceOf(ObjectType::class, $methodReflection->getReturnType()); |
| 58 | + $this->assertSame(\Dibi\Fluent::class, $methodReflection->getReturnType()->getClass()); |
| 59 | + $this->assertFalse($methodReflection->getReturnType()->isNullable()); |
| 60 | + } |
| 61 | + |
44 | 62 | }
|
0 commit comments