2
2
3
3
namespace PHPStan \Reflection \Dibi ;
4
4
5
- use PHPStan \Reflection \ClassReflection ;
6
-
7
- class DibiFluentClassReflectionExtensionTest extends \PHPUnit \Framework \TestCase
5
+ class DibiFluentClassReflectionExtensionTest extends \PHPStan \Testing \TestCase
8
6
{
9
7
8
+ /** @var \PHPStan\Broker\Broker */
9
+ private $ broker ;
10
+
10
11
/** @var \PHPStan\Reflection\Dibi\DibiFluentClassReflectionExtension */
11
12
private $ extension ;
12
13
13
14
protected function setUp ()
14
15
{
16
+ $ this ->broker = $ this ->createBroker ();
15
17
$ this ->extension = new DibiFluentClassReflectionExtension ();
16
18
}
17
19
@@ -36,15 +38,13 @@ public function dataHasMethod(): array
36
38
*/
37
39
public function testHasMethod (string $ className , bool $ result )
38
40
{
39
- $ classReflection = $ this ->createMock (ClassReflection::class);
40
- $ classReflection ->method ('getName ' )->will ($ this ->returnValue ($ className ));
41
+ $ classReflection = $ this ->broker ->getClass ($ className );
41
42
$ this ->assertSame ($ result , $ this ->extension ->hasMethod ($ classReflection , 'select ' ));
42
43
}
43
44
44
45
public function testGetMethod ()
45
46
{
46
- $ classReflection = $ this ->createMock (ClassReflection::class);
47
- $ classReflection ->method ('getName ' )->will ($ this ->returnValue (\Dibi \Fluent::class));
47
+ $ classReflection = $ this ->broker ->getClass (\Dibi \Fluent::class);
48
48
$ methodReflection = $ this ->extension ->getMethod ($ classReflection , 'select ' );
49
49
$ this ->assertSame ('select ' , $ methodReflection ->getName ());
50
50
$ this ->assertSame ($ classReflection , $ methodReflection ->getDeclaringClass ());
0 commit comments