1. Go to this page and download the library: Download apiframework/test 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/ */
apiframework / test example snippets
class Robot
{
protected $cache = [];
public function addToCache($key, $value) {
$this->cache[$key] = $value;
}
protected function helloTwo($one, $two)
{
return "hello $one $two";
}
}
$robot = new Robot;
$protected = (new Apiframework\Test\ProtectedReflectionFactory)->build($robot);
// Accepts an array of arguments equal to the amount of arguments of the method
$helloTwo = $protected->invokeMethod("helloTwo", ['varOne', 'varTwo']);
var_dump($helloTwo);