diff options
Diffstat (limited to 'test/unit/TestUtils/ClassUtils.php')
-rw-r--r-- | test/unit/TestUtils/ClassUtils.php | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/test/unit/TestUtils/ClassUtils.php b/test/unit/TestUtils/ClassUtils.php index 26d264c..b25ca56 100644 --- a/test/unit/TestUtils/ClassUtils.php +++ b/test/unit/TestUtils/ClassUtils.php @@ -1,56 +1,64 @@ <?php + namespace SparkPost\Test\TestUtils; +class ClassUtils +{ + private $class; -class ClassUtils { + public function __construct($fqClassName) + { + $this->class = new \ReflectionClass($fqClassName); + } - private $class; + /** + * Allows access to private methods. + * + * This is needed to mock the GuzzleHttp\Client responses + * + * @param string $name + * + * @return ReflectionMethod + */ + public function getMethod($method) + { + $method = $this->class->getMethod($name); + $method->setAccessible(true); - public function __construct($fqClassName) { - $this->class = new \ReflectionClass($fqClassName); - } + return $method; + } - /** - * Allows access to private methods - * - * This is needed to mock the GuzzleHttp\Client responses - * - * @param string $name - * @return ReflectionMethod - */ - public function getMethod($method) { - $method = $this->class->getMethod($name); - $method->setAccessible(true); - return $method; - } + /** + * Allows access to private properties in the Transmission class. + * + * This is needed to mock the GuzzleHttp\Client responses + * + * @param string $name + * @param {*} + * + * @return ReflectionMethod + */ + public function getProperty($instance, $property) + { + $prop = $this->class->getProperty($property); + $prop->setAccessible(true); - /** - * Allows access to private properties in the Transmission class - * - * This is needed to mock the GuzzleHttp\Client responses - * - * @param string $name - * @param {*} - * @return ReflectionMethod - */ - public function getProperty($instance, $property) { - $prop = $this->class->getProperty($property); - $prop->setAccessible(true); - return $prop->getValue($instance); - } - /** - * Allows access to private properties in the Transmission class - * - * This is needed to mock the GuzzleHttp\Client responses - * - * @param string $name - * @param {*} - * @return ReflectionMethod - */ - public function setProperty($instance, $property, $value) { - $prop = $this->class->getProperty($property); - $prop->setAccessible(true); - $prop->setValue($instance, $value); - } + return $prop->getValue($instance); + } + /** + * Allows access to private properties in the Transmission class. + * + * This is needed to mock the GuzzleHttp\Client responses + * + * @param string $name + * @param {*} + * + * @return ReflectionMethod + */ + public function setProperty($instance, $property, $value) + { + $prop = $this->class->getProperty($property); + $prop->setAccessible(true); + $prop->setValue($instance, $value); + } } -?> |