File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -424,4 +424,29 @@ function fetch_data(PDO $PDO):array
424
424
425
425
$data=fetch_data($mockPdo);
426
426
print_r($data);////['id' => 1, 'name' => 'Dilo Surucu']
427
+ ```
428
+ ** onInstanceCreated**
429
+
430
+ This method is triggered when the object is instantiated.
431
+ ``` php
432
+
433
+ $mockMethod = new MockMethod();
434
+
435
+ $mockMethod->mockMethod('test', function () {
436
+ return 'test foo';
437
+ });
438
+ $mockMethod->mockMethod('now', function (int $a) {
439
+ return $a;
440
+ });
441
+
442
+
443
+ $mockFactory = new MockFactory($mockMethod);
444
+ $mockFactory
445
+ ->onInstanceCreated(function (Date $date) {
446
+ echo $date->test(); //test foo
447
+
448
+ //$date->__construct(); for custom constructor
449
+ })
450
+ ->createMock(Date::class, ['a' => 1]);
451
+
427
452
```
You can’t perform that action at this time.
0 commit comments