1. Go to this page and download the library: Download michalv8/xpmock 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/ */
// get value of any property: static/non-static, public/protected/private
$value = $this->reflect('MyClass')->property; // class name (only static)
$value = $this->reflect(new MyClass())->property; // object
// set value of any property: static/non-static, public/protected/private property
$this->reflect('MyClass')->property = $value; // class name (only static)
$this->reflect(new MyClass())->property = $value; // object
$this->reflect(new MyClass())
->__set('property1', $value1)
->__set('property2', $value2); // chain
// call any method: static/non-static, public/protected/private
$this->reflect('MyClass')->method($arg); // class name (only static)
$this->reflect(new MyClass())->method($arg); // object
class MyTestCase extends \PHPUnit_Framework_TestCase
{
use \Xpmock\TestCaseTrait;
}