1. Go to this page and download the library: Download eloquent/phony-kahlan library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eloquent / phony-kahlan example snippets
// kahlan-config.php// disable monkey-patching for Phony classes$this->commandLine()->set('exclude', ['Eloquent\Phony']);
// install the plugin once autoloading is available
Kahlan\Filter\Filters::apply($this, 'run', function(callable $chain){
Eloquent\Phony\Kahlan\install();
return $chain();
});
describe('Phony for Kahlan', function(){
it('Auto-wires test dependencies', function(PDO $db){
expect($db)->toBeAnInstanceOf(PDO::class);
});
});
usefunctionEloquent\Phony\Kahlan\on;
describe('Phony for Kahlan', function(){
it('Supports stubbing', function(PDO $db){
on($db)->exec->with('DELETE FROM users')->returns(111);
expect($db->exec('DELETE FROM users'))->toBe(111);
});
it('Supports verification', function(PDO $db){
$db->exec('DROP TABLE users');
on($db)->exec->calledWith('DROP TABLE users');
});
});