You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

61 lines
1.6 KiB

<?php
declare(strict_types=1);
namespace App\Tests;
use ReflectionClass;
use ReflectionException;
use ReflectionProperty;
/**
* Inherited Methods.
*
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;
/**
* @param mixed $classObject
*
* @throws ReflectionException
*/
public function getClassProperty($classObject, string $propertyName): ReflectionProperty
{
$reflector = new ReflectionClass($classObject);
$property = $reflector->getProperty($propertyName);
$property->setAccessible(true);
return $property;
}
/**
* @param mixed $object
*
* @return mixed
*
* @throws ReflectionException
*/
public function invokeMethod($object, string $methodName, array $parameters = [])
{
$reflection = new ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $parameters);
}
}