PHP code example of feedtailor / mocking-property-modifier

1. Go to this page and download the library: Download feedtailor/mocking-property-modifier 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/ */

    

feedtailor / mocking-property-modifier example snippets


use Feedtailor\Mocking\PropertyModifier;

class ExampleClass
{
    protected $foo = 10;

    public function getFoo()
    {
        return $this->foo;
    }
}

$obj = new ExampleClass();

echo $obj->getFoo();  // 10

PropertyModifier::create($obj)->modify("foo", 42);

echo $obj->getFoo();  // 42