Skip to content

Commit 5c6b578

Browse files
committed
Added getMethod test
1 parent c887487 commit 5c6b578

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\Reflection\Dibi;
44

55
use PHPStan\Reflection\ClassReflection;
6+
use PHPStan\Type\ObjectType;
67

78
class DibiFluentClassReflectionExtensionTest extends \PHPUnit_Framework_TestCase
89
{
@@ -41,4 +42,21 @@ public function testHasMethod(string $className, bool $result)
4142
$this->assertSame($result, $this->extension->hasMethod($classReflection, 'select'));
4243
}
4344

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+
4462
}

0 commit comments

Comments
 (0)