6
6
use Moka \Exception \MissingDependencyException ;
7
7
use Moka \Strategy \AbstractMockingStrategy ;
8
8
use Moka \Stub \MethodStub ;
9
- use PHPUnit_Framework_MockObject_Generator as MockGenerator ;
10
- use PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount as AnyInvokedCountMatcher ;
11
- use PHPUnit_Framework_MockObject_MockObject as MockObject ;
9
+ use PHPUnit \ Framework \ MockObject \ Generator ;
10
+ use PHPUnit \ Framework \ MockObject \ Matcher \ AnyInvokedCount ;
11
+ use PHPUnit \ Framework \ MockObject \ MockObject ;
12
12
13
13
/**
14
14
* Class PHPUnitMockingStrategy
15
15
* @package Moka\Strategy
16
16
*/
17
17
class PHPUnitMockingStrategy extends AbstractMockingStrategy
18
18
{
19
- const CLASS_NAME = MockGenerator ::class;
19
+ const CLASS_NAME = Generator ::class;
20
20
const PACKAGE_NAME = 'phpunit/phpunit-mock-objects ' ;
21
21
22
22
/**
23
- * @var MockGenerator
23
+ * @var Generator
24
24
*/
25
25
private $ generator ;
26
26
@@ -33,16 +33,17 @@ public function __construct()
33
33
{
34
34
self ::checkDependencies (self ::CLASS_NAME , self ::PACKAGE_NAME );
35
35
36
- $ this ->generator = new MockGenerator ();
36
+ $ this ->generator = new Generator ();
37
37
$ this ->setMockType (MockObject::class);
38
38
}
39
39
40
40
/**
41
41
* @param string $fqcn
42
42
* @return MockObject
43
43
*
44
- * @throws \InvalidArgumentException
45
- * @throws \PHPUnit_Framework_MockObject_RuntimeException
44
+ * @throws \PHPUnit\Framework\Exception
45
+ * @throws \PHPUnit\Framework\MockObject\RuntimeException
46
+ * @throws \ReflectionException
46
47
*/
47
48
protected function doBuild (string $ fqcn )
48
49
{
@@ -58,14 +59,15 @@ protected function doBuild(string $fqcn)
58
59
/**
59
60
* @param MockObject $mock
60
61
* @param MethodStub $stub
61
- * @return void
62
+ *
63
+ * @throws \PHPUnit\Framework\MockObject\RuntimeException
62
64
*/
63
65
protected function doDecorateWithMethod ($ mock , MethodStub $ stub )
64
66
{
65
67
$ methodName = $ stub ->getName ();
66
68
$ methodValue = $ stub ->getValue ();
67
69
68
- $ partial = $ mock ->expects (new AnyInvokedCountMatcher ())->method ($ methodName );
70
+ $ partial = $ mock ->expects (new AnyInvokedCount ())->method ($ methodName );
69
71
$ methodValue instanceof \Throwable
70
72
? $ partial ->willThrowException ($ methodValue )
71
73
: $ partial ->willReturn ($ methodValue );
0 commit comments