feedtailor / mocking-property-modifier
A property modifier for Mock object.
1.0.0
2014-07-23 07:09 UTC
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-11-05 04:08:03 UTC
README
A property modifier for Mock object.
Install
feedtailor/mocking-property-modifier を composer.json に追加して、 composer install
を実行します。
{ "require": { "feedtailor/mocking-property-modifier": "dev-master" } }
Example
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
Methods
$modifier = new PropertyModifier($obj);
$modifier = PropertyModifier::create($obj);
Create a new $modifier
instance.
$modifier->modify($name, $value);
modify a $name
property to $value
.
$modifier->modifyAll($values);
modify properties by associative array $values
.
License
Licensed under the MIT License.