dev-master
9999999-dev https://github.com/apiframework/TestTest writing utilities.
BSD-3-Clause
The Requires
- php >=5.3.0
test
0.0.1
0.0.1.0 https://github.com/apiframework/TestTest writing utilities.
BSD-3-Clause
The Requires
- php >=5.3.0
test
Wallogit.com
2017 © Pedro Peláez
Test writing utilities.
Test writing utilities, (*2)
Allows easy testing for protected methods and properties., (*3)
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);
string(19) "hello varOne varTwo"
$protected->invokeMethod("addToCache", ['david', 'bowie']); $cache = $protected->getProperty("cache"); var_dump($cache);
array(1) {
'david' =>
string(5) "bowie"
}
$protected->setProperty("cache", ['fab' => 'four']); $cache = $protected->getProperty("cache"); var_dump($cache);
``` array(1) { 'fab' => string(4) "four" }, (*4)
Test writing utilities.
BSD-3-Clause
test
Test writing utilities.
BSD-3-Clause
test