File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 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;
1010 * @license http://www.wtfpl.net/txt/copying/ WTFPL
1111 * @internal
1212 */
13- abstract class MockDelegateFunction implements FunctionProvider
13+ class MockDelegateFunction implements FunctionProvider
1414{
1515
1616 /**
1717 * A mocked function will redirect its call to this method.
1818 *
1919 * @return mixed Returns the function output.
2020 */
21- abstract public function delegate({signatureParameters} );
21+ public function delegate({signatureParameters} )
22+ {
23+ }
2224
2325 public function getCallable()
2426 {
2527 return [$this , " delegate" ];
2628 }
29+
30+ public function { functionName} ()
31+ {
32+ }
2733}
Original file line number Diff line number Diff line change @@ -52,11 +52,13 @@ public function build($functionName = null)
5252 $ parameterBuilder ->build ($ functionName === null ? '' : $ functionName );
5353 $ signatureParameters = $ parameterBuilder ->getSignatureParameters ();
5454
55+ $ populatedFunctionName = $ functionName === null ? '_dummy ' : $ functionName ;
56+
5557 /**
5658 * If a class with the same signature exists, it is considered equivalent
5759 * to the generated class.
5860 */
59- $ hash = md5 ($ signatureParameters );
61+ $ hash = md5 ($ populatedFunctionName . $ signatureParameters );
6062 $ this ->namespace = __NAMESPACE__ . $ hash ;
6163 if (class_exists ($ this ->getFullyQualifiedClassName ())) {
6264 return ;
@@ -65,6 +67,7 @@ public function build($functionName = null)
6567 $ data = [
6668 "namespace " => $ this ->namespace ,
6769 "signatureParameters " => $ signatureParameters ,
70+ "functionName " => $ populatedFunctionName ,
6871 ];
6972 $ this ->template ->setVar ($ data , false );
7073 $ definition = $ this ->template ->render ();
You can’t perform that action at this time.
0 commit comments