File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -10,18 +10,24 @@ use phpmock\functions\FunctionProvider;
10
10
* @license http://www.wtfpl.net/txt/copying/ WTFPL
11
11
* @internal
12
12
*/
13
- abstract class MockDelegateFunction implements FunctionProvider
13
+ class MockDelegateFunction implements FunctionProvider
14
14
{
15
15
16
16
/**
17
17
* A mocked function will redirect its call to this method.
18
18
*
19
19
* @return mixed Returns the function output.
20
20
*/
21
- abstract public function delegate({signatureParameters} );
21
+ public function delegate({signatureParameters} )
22
+ {
23
+ }
22
24
23
25
public function getCallable()
24
26
{
25
27
return [$this , " delegate" ];
26
28
}
29
+
30
+ public function { functionName} ()
31
+ {
32
+ }
27
33
}
Original file line number Diff line number Diff line change @@ -52,11 +52,13 @@ public function build($functionName = null)
52
52
$ parameterBuilder ->build ($ functionName === null ? '' : $ functionName );
53
53
$ signatureParameters = $ parameterBuilder ->getSignatureParameters ();
54
54
55
+ $ populatedFunctionName = $ functionName === null ? '_dummy ' : $ functionName ;
56
+
55
57
/**
56
58
* If a class with the same signature exists, it is considered equivalent
57
59
* to the generated class.
58
60
*/
59
- $ hash = md5 ($ signatureParameters );
61
+ $ hash = md5 ($ populatedFunctionName . $ signatureParameters );
60
62
$ this ->namespace = __NAMESPACE__ . $ hash ;
61
63
if (class_exists ($ this ->getFullyQualifiedClassName ())) {
62
64
return ;
@@ -65,6 +67,7 @@ public function build($functionName = null)
65
67
$ data = [
66
68
"namespace " => $ this ->namespace ,
67
69
"signatureParameters " => $ signatureParameters ,
70
+ "functionName " => $ populatedFunctionName ,
68
71
];
69
72
$ this ->template ->setVar ($ data , false );
70
73
$ definition = $ this ->template ->render ();
You can’t perform that action at this time.
0 commit comments