Skip to content

Commit 62a9a26

Browse files
using of the short syntax added for MockFunction
1 parent f7864d3 commit 62a9a26

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,18 @@ $mockFunction->endScope();
293293
sleep(1);//it'll do wait for 1 second because out of the scope
294294
echo time();//it'll return the real time because it's out of the scope
295295
```
296+
or short syntax, Return value can be added to mock function in two ways, type 1 and type 2.
297+
```php
298+
299+
$mockFunction = new MockFunction();
300+
//type 1
301+
$mockFunction->add('date','2011');
302+
303+
//type 2
304+
$mockFunction->add('date',function (){
305+
return '2011'
306+
});
307+
```
296308
### Scope management
297309
Sometimes we may want to use mock function for objects. Here is an example; we can determine the scope area with the scope method.
298310
```php

0 commit comments

Comments
 (0)