exposer / class-exposer
Allows access to a classes private methods and properties
v1.0.0
2015-08-22 12:06 UTC
Requires (Dev)
- phpunit/phpunit: 4.8.5
This package is not auto-updated.
Last update: 2024-11-09 18:46:56 UTC
README
Why?
Useful for testing private and protected methods in a class.
##Installation
You can simply download or copy & paste the ClassExposer.php class and include it in your own php files.
Composer
Also available via Composer:
$ composer require exposer/class-exposer
Make sure you have minimum-stability set to 'dev' in your composer.json file.
Usage
// Include the ClassExposer Class
require_once 'ClassExposer.php';
// Pass an object instance in to the ClassExposer
$myExposedClass = new Exposer\ClassExposer(new MyClass());
// Access all methods and properties as normal
$myExposedClass->myPrivateMethod();
$myExposedClass->myPrivateProperty = "foo";
echo $myExposedClass->myPrivateProperty;