1. Go to this page and download the library: Download mnapoli/mockup library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$mock = mock(Foo::class, [
'foo' => function ($bar) {
return strtoupper('hello ' . $bar);
}
]);
$mock->foo('john'); // HELLO JOHN
use function Mockup\{spy, inspect};
$spy = spy($cache);
$foo->doSomething($spy);
inspect($spy)->set()->invokationCount(); // number of calls to $spy->set()
inspect($spy)->set()->parameters(0); // parameters provided to the first call to $spy->set()
inspect($spy)->set()->returnValue(0); // value returned by the first call to $spy->set()
use function Mockup\{mock, inspect};
$mock = mock(CacheInterface::class);
$foo->doSomething($mock);
inspect($spy)->set()->invokationCount();
inspect($spy)->set()->parameters(0);
inspect($spy)->set()->returnValue(0);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.