clevis/utils-functions-proxy

Simple proxy to function calls that can be mocked.

dev-master 2013-08-28 19:06 UTC

This package is not auto-updated.

Last update: 2024-05-07 01:38:15 UTC


README

Usage

/** @var ICurlProxy $curl */
$curl = new FunctionsProxy('curl_');

$handle = $curl->init();
$curl->setopt($handle, CURLOPT_URL, 'example.com');
$curl->setopt($handle, CURLOPT_RETURNTRANSFER, 1);
$response = $curl->exec($handle);
$curl->close();

Why

Because unlike built-in functions, this proxy could be mocked in tests.